Before share scripts
A before share script allows the current record that is being dynamic shared or bulk shared to be processed after it is loaded into a GlideRecord, but before it is encrypted and queued up to the Perspectium Cloud Server. Before share scripts expect server side javascript and is preconfigured with a globally available variable called current that is the GlideRecord object that is going to be shared.
NOTE: Because before share scripts are executed every time a record is shared, be aware of the processing delays introduced that will be multiplied when sharing multiple records at the same time. Also, if you have multiple share configurations for the same table (such as different share configurations that each have a different target queue), any changes to the current object may affect any conditions you have to share since this same current object is referenced as we iterate through the table's different share configurations.
To cancel a bulk share in a before share script, see canceling a bulk share in a before share script.
After subscribe scripts
An After share script for dynamic shares allows you to specify a script that will run after your dynamic share has shared a record. This can be useful for when you run scripts in the before share script for your dynamic share that you want to then cancel out after the dynamic share has run.
To specify a foreign language to dynamic share out, see specifying a foreign language in a dynamic share after share script.
Prerequisites
First, you will need to create a dynamic share or create a bulk share.
Create before/after share scripts
To create before/after share scripts, follow these steps:
Access your dynamic share or bulk share
Log into your sharing (source) ServiceNow instance and navigate to Perspectium > Replicator > Dynamic Share or Bulk Share. Then, click into the dynamic share or bulk share that you want to create before/after share scripts for.
Type your before/after share script
Click the Filter and Enrichment tab. Then, type your before share script or after share script in the associated scripting window.
Click Update
Near the bottom left-hand corner of the form (just above Related Links), click Update to save the changes to your dynamic share or bulk share.