Scope: Applies to all ServiceNow->DB migration projects.
Warning: Target deletions are not recoverable. Please be sure you test any configuration thoroughly on a Pre-Production instance first.
The Target Deletion tab on Form Mappings is only enabled for ServiceNow->DB migration projects. The Target Deletion functionality is provided to delete records from the target database that were previously migrated but have since been deleted or archived within ServiceNow. This will ensure that the records in both are kept in sync.
By default, no records will be deleted on the target database. If you do wish to delete any from the target database to reflect those deleted from Service Now, you have two options for the Delete Method:
| Delete Unmatched Records Only | The records in the target database table will be compared to those in the ServiceNow source form. Any that exist in the database that no longer exist in the form in ServiceNow will be deleted from the table in the database. |
| Delete Target Records From Source Query |
Entries in a selected table in ServiceNow will be queried to determine which records should be deleted from the target database table. Usually the selected table will be either the Audit Deleted Record table (sys_audit_delete) if the goal is to delete the same records on the target that were deleted on the source. An alternative use case would be to query the archive table and delete target records that have been archived on the source. You can however use any search table and query to identify the records to be deleted. For example, if synchronizing incidents, you can query the incident table to delete those on the target that are now 'closed' on source. |
The Delete Target Records From Source Query option is the recommended option with regards to performance. However, this is reliant upon having some record on the source server of records that have been deleted/archived.
If this option is not possible then select the Delete Unmatched Records Only option. Note that this may take some time if the source form has a large number of records to check.
The following text explains some use cases in more detail:
Use Case 1: Delete records from the target that were recorded as deleted on the source
For this use case, we can use the deletion audit records to identify deleted records. This would be configured as shown above. Note the query is optional, in the example above, it is configured for a delta migration, with only the deletions that occurred since the last migration being considered.
Precision Bridge will query the Audit Deleted Record table for the id's of deleted records (given by the Document Key field). it will then check which of these records exist on the target. Finally, the target records will be deleted.
Use Case 2: Delete records that have been moved to archive tables on the source
For this use case, we can use the archive records to identify deleted records. This would be configured as shown below (select the appropriate archive table for your mapping). Again, the query is optional, in the example below, it is configured for a delta migration, with only the deletions that occurred since the last migration being considered.
Precision Bridge will query the Archive table for the id's of deleted records (given by the Sys ID field). It will then check which of these records exist on the target. Finally, the target records will be deleted.
Note that you don't have to use the sys id field, but whichever field you use must be populated on the source and target, and must uniquely identify the record.
Use Case 3: There is no record on the source of which records were deleted, just need to delete those that no longer exist on the source.
In this case, we have to use the Delete Unmatched Records option for a more brute force approach.
Precision Bridge will extract all the sys_ids from the target. This can take some time if the table is large, and is not recommended if the number of records being matched >100,000.
Precision Bridge will then retrieve all the records from the source and cross reference with those on the target. Records found on the target but not the source will be deleted.
Again, you need to specify the name of the database column in the target table where the Sys ID field value is stored in the Select Target ID Field.
Additional Options
You can specify whether the deletions are performed pre- or post- migration of records by specifying Delete Before Migration or Delete After Migration in the Deletion Timing configuration setting.
Comments
0 comments
Please sign in to leave a comment.