After subscribe scripts (server-side JavaScript) will run after an inbound (subscribed) record from a sharing instance is synced on the subscribing instance. Within your after subscribe script, you have access to the following variables:
Variable | Description |
---|---|
current | Record that was inserted, updated or deleted, the destination record |
qcurrent | Record within the psp_in_message table (pulled from the Perspectium Mesh). Use the message's key value to determine its source. |
qcurrentxml | Holds the xml object of the inbound record |
xml_util | Holds an xml utility for working with qcurrentxml |
subscribe_gr | Holds the GlideRecord object corresponding to the subscribe record configuration itself (You can use subscribe_gr.getTableName() to access the name of the table you're trying to insert) |
Prerequisites
First, you will need to follow the steps to get started with Replicator.
Procedure
To create an after subscribe script, follow these steps:
Log into a sharing ServiceNow instance that has another ServiceNow instance configured as a subscriber.
In the left side navigation window, navigate to Perspectium > Replicator > Subscribe.
Click the timestamp next to the name of the subscribe record you want to create an after subscribe script for.
Click the Filter and Enrichment tab. Then, scroll down to the After subscribe script window and start typing your script.
In the upper right-hand corner of the form, click Update to save your changes.