You are viewing an old version of this page. View the current version.

Compare with Current View Page History

Version 1 Next »

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

currentRecord that was inserted, updated or deleted, the destination record
qcurrentRecord within the psp_in_message table (pulled from the Perspectium Mesh). Use the message's key value to determine its source.
qcurrentxmlHolds the xml object of the inbound record
xml_utilHolds an xml utility for working with qcurrentxml
subscribe_grHolds 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


(warning) 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.