Versions Compared

Key

  • This line was added.
  • This line was removed.
  • Formatting was changed.

UI Button
colormagenta
tooltipInformation on this page pertains to the Perspectium Fluorine release
titleFluorine
urlhttps://docdocs.perspectium.com/display/fluorine


Before subscribe scripts


Before subscribe scripts are created with server-side JavaScript and will execute right before an insert or update allowing a chance to modify the record before persisting. Within your before subscribe script, you have access to the following variables:


VariableDescription
currentRecord that is being inserted or updated
repl_grTemporary inbound record. Will be mapped to repl_gr by default.
gr_beforeRecord before any update is made to it. If the record doesn't exist (i.e., for an insert), then this variable will be assigned to current.
qcurrentRecord within the psp_in_message table (pulled from the Perspectium Mesh). Use the message's key value to determine its source.
ignoreCan assign a value of true in order to stop the execution of the subscribe
qcurrentxmlHolds the xml object of the inbound record
xml_utilHolds an xml utility for working with qcurrentxml


After subscribe scripts


After subscribe scripts are also created with server-side JavaScript and 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 configure a ServiceNow instance as a subscriber.

Procedure

Create before/after subscribe scripts

To create a before/after subscribe script, follow these steps:


UI Steps
UI Step

Log into a sharing ServiceNow instance that has another ServiceNow instance configured as a subscriber.

UI Step

In the Filter Navigator on the upper left-hand side of the screen., navigate to Perspectium > Replicator > Subscribe.

UI Step

Click the timestamp next to the name of the subscribe record you want to create a before/after subscribe script for.

UI Step

Click the Filter and Enrichment tab. Then, scroll down to the After subscribe script window or the Before subscribe script window and start typing your script.

UI Step

In the upper right-hand corner of the form, click Update to save your changes.



Similar topics


Content by Label
showLabelsfalse
max5
showSpacefalse
sortmodified
cqllabel = "optional-config" and parent = "6096035"


Contact Perspectium Support


US: 1 888 620 8880

UK: 44 208 068 5953

support@perspectium.com