To compile timestamped "snapshots" of your ServiceNow data, you can configure your DataSync Agent with the <temporal> directive. <temporal> will allow you to indicate times when your record's data is/was valid from and when the data is/was valid to.
NOTE: To set up a temporal data, the table you are syncing data to must not contain any records (i.e., Temporal data cannot be captured for tables that are already being synced to a database with a DataSync Agent).
WARNING! If you have already configured an integration with a DataSync Agent and have been saving records in a database, but you would now like to enable or disable temporal replication, update the value within the agent.xml's <database> directive to a new database. Otherwise records will not be processed properly.
To set up a temporal data in a local database, follow these steps:
Access your agent.xml configuration file
Navigate to the directory where you saved your agent.xml file when installing your DataSync Agent.
Add the <temporal> directive
Open your agent.xml file in a text editing application. To use the default configurations for syncing temporal data (columns will be named psp_valid_from and psp_valid_to and the maximum psp_valid_to value will be 9999-01-01 01:01:01), add the <temporal/> self-closing tag anywhere within the <task> tag. An example of this agent.xml is shown below. Otherwise, to create custom configurations for your temporal database, see Step #3.
Example agent.xml for default temporal data configurations:
Create custom configurations (optional)
- To customize your temporal database table's maximum date & time stamp in the psp_valid_to column, add the directive shown below within the <temporal> tag, replacing the red text with any value you would like to assign for custom configuration.
NOTE: If records already exist in your temporal database table and then the <maxdatetime> value is changed, any records that were previously timestamped in the psp_valid_to column will not be updated to reflect the newly entered <max_datetime> value.
- You can customize the column names for the psp_valid_from and psp_valid_to columns by modifying the values within the <column type="from"> and <column type="to"> directives, respectively.
- As of Fluorine Plus Patch 9 (version 4.8.9), you can choose to skip inserting duplicate entries by adding directive <skip_duplicates/> inside the <temporal> directive. With the <skip_duplicates/>, the Agent will check if the new record has the same updated (sys_updated_on) datetime as the latest record and if so, skip inserting that record into the table. In Fluorine Plus Patch 13 (version 4.8.13), you can add the attribute check_all_fields in the <skip_duplicates/> directive to check the fields values if the updated time is the same from the previous share.
NOTE: This may affect the Agent’s performance as it checks with the database and does a comparison every time a message comes in.
Save your agent.xml file
Save the changes you made to your agent.xml file and close the file.
Confirm temporal data sharing
Log into the database that your DataSync Agent is sharing data to, and confirm that psp_valid_from and psp_valid_to timestamps are being created and that the psp_valid_to timestamp is updated whenever a change is made to the same record.
NOTE: By default, the primary keys for the subscribed table your database will be a composite key comprised of the sys_id value, from column value, and to column value.