Sync of Data from third party to Servicenow
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
09-08-2024 04:25 AM
Hi All,
I'm working on syncing data from a third-party system to ServiceNow using a data source for this integration. When data is received from the third-party and stored in the source table, I want to import it into the target table only for records that have changed since the last schedule.
Currently, I do not have a last sync timestamp available from source/third-party.
Can anyone suggest a method or best practice to handle delta sync without a last sync timestamp, or provide alternative approaches for tracking changes?
However I'm using colease field here , will that work making it as true?
Thank you!
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
09-08-2024 04:56 AM
If your source has unique keys, I think it's best practice to use "Coalesce Fields".
1. Using Coalesce Fields
Since you are using a coalesce field, this can work effectively to identify changes. Coalescing fields in ServiceNow allows you to uniquely identify records. If the data from the third-party system includes a unique identifier (e.g., a primary key or unique reference), you can set that field as the coalesce field in your import set.
- How it works:
- When a record with the same coalesce value already exists in the target table, ServiceNow will update the existing record.
- If no matching coalesce field is found, a new record will be created.
- Note: This method will only overwrite records, not delete old ones unless you add custom logic to handle deletions.
2. Change Detection Using Hashing
If you don't have a timestamp from the source, you can implement a hashing mechanism to track changes. Here's how:
- Before importing the data into the target table, generate a hash of the relevant fields (e.g., combine all significant fields and compute a hash value).
- Store this hash in a separate field for each record.
- During subsequent imports, compare the new hash with the stored hash to detect changes. Only import or update records where the hash has changed.
This method is useful for detecting changes even if there is no timestamp, as it compares the actual data.
3. Maintain a Custom "Last Sync" Table in ServiceNow
Since the third-party system doesn't provide a last sync timestamp, you could create a custom table in ServiceNow to store the sync state manually:
- After every successful data sync, store a reference to the records that were imported, along with a timestamp of when they were last synced.
- On the next sync, you can compare incoming records against this table to determine whether a record has changed (based on a unique ID or hash).
- This approach requires more effort but allows you to track sync history.