---
title: "Before/after subscribe scripts"
canonical: "https://docs.perspectium.com/space/fluorineplus/2621852/Before%2Fafter%20subscribe%20scripts"
format: markdown
---
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: Variable Description current Record that is being inserted or updated repl_gr Temporary inbound record. Will be mapped to  repl_gr  by default. gr_before Record 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. qcurrent Record within the  psp_in_message   table (pulled from the  Perspectium Mesh ).   Use the message's  key  value to determine its source. ignore Can assign a value of  true  in order to stop the execution of the subscribe qcurrentxml Holds the xml object of the inbound record xml_util Holds 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 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  configure a ServiceNow instance as a subscriber . Create before/after subscribe scripts To create a before/after subscribe script, follow these steps: Similar topics Contact Perspectium Support US:  1 888 620 8880 UK:  44 208 068 5953 support@perspectium.com