Cloning - Adjusting the tables that have attachments copied when excluding attachments

- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
08-14-2024 07:44 AM
I'm trying to figure out the best way forward with this so thought I'd see if anyone knows or has done a similar thing.
We don't like to bring our task related attachments over in a clone, so we generally select the "Exclude Attachment Data" option. While this worked for a while, now with some custom apps that we have created, these apps break after a clone because they require some attachments that are not being brought over.
So I'm curious if there is a way to adjust the list of tables that are ignored OOB in order to add these few tables to it?
I would like to add the sysevent_email_template table to the list below that is not affected when choosing not to copy attachments.
The following ServiceNow out-of-the-box attachments and other system-relevant files are not affected by this setting and are not excluded from a clone:
- Table name values that start with ZZ_.
- Table names: sys_certificate, sc_cat_item,sys_upgrade_manifest, ecc_agent_jar, ecc_agent_mib, sys_store_app, or invisible.sys_store_app.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
08-14-2024 11:43 AM
There is no way to partially exclude a table, but you can use data preservers to prevent certain attachments already present in the clone target instance from being deleted during the clone.
Blog: https://sys.properties | Telegram: https://t.me/sys_properties | LinkedIn: https://www.linkedin.com/in/slava-savitsky/

- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
08-15-2024 05:12 AM
I'm not trying to partially exclude a table, I'm trying to add a table to the list of tables that bypass the exclusion setting.
The plan is to use data preservers as a last resort, but I'll go that route if needed.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
08-15-2024 06:52 AM
I don't think there are many other options available.
All attachments for all tables are stored in [sys_attachment] and [sys_attachment_doc] table. You can only exclude or include those tables completely (all records). There is no way to exclude only a subset of [sys_attachment] and [sys_attachment_doc] records, depending on which table the main record to which the attachment belongs is in.
You could let the clone copy all attachments to the target instance and then run a post-clone cleanup script to delete the ones you don't need, but that can take a long time depending on the size of the attachments table.
Another possibility is to run the clone twice. The first clone would copy all attachments to the target instance. For the second clone, you could exclude attachments (so that they are not copied again from the source instance) and also preserve a subset of attachments that were copied over during the first clone. Unlike table exclusion rules, data preservers have a condition builder ("Conditions" field) that lets you apply a filter.
Blog: https://sys.properties | Telegram: https://t.me/sys_properties | LinkedIn: https://www.linkedin.com/in/slava-savitsky/