This is an old revision of the document!
v3.1.8
A before share script allows the current record that is being shared to be processed after it is loaded into a GlideRecord, but before it is encrypted and queued up to the Perspectium Cloud Server.
The script expects server side javascript, and is preconfigured with a globally available variable called current that is the GlideRecord object that is going to be shared.
For example, to ensure that the short_description field value of a record to always be greater than 0 and less than 1000 characters, you may use the following script:
var s = current.short_description.toString(); current.short_description = s.substring(0, 1000);
Because this script is executed overtime a record is shared, be aware of the processing delays introduced that will be multiplied when sharing multiple records at the same time.