User Tools

Site Tools



This shows you the differences between two versions of the page.

Link to this comparison view

psp_action_in_before_share_script [2016/08/18 14:20] (current)
paul created
Line 1: Line 1:
 +===== psp_action in the Before Share Script =====
 +<wrap info>​[[updateset_releases|v3.12.0]]</​wrap>​
 +In the [[before_share_script|Before Share Script]] of a Dynamic or Bulk share configuration,​ you can set the global variable //​psp_action//​ to specify the "​action"​ value of records being shared.
 +"​action"​ is the value that appears after the table name in the "​name"​ field of outgoing Replicator messages. ​ For example, action is "​insert"​ in "​incident.insert"​ (for records being inserted), "​update"​ in "​incident.update"​ (records being updated) and so forth. ​ This is useful for integrations with other systems where you want the table to designate a different action from the default one ServiceNow specifies.
 +For example, say you are integrating with another system and using the correlation_id to designate the incident record'​s number in the other system. ​ If there was a failure creating the incident in the other system and you do an update to the incident in ServiceNow, instead of sending the record as an "​update",​ you may want to send it as an "​insert"​ instead so as to create the incident in the other system this time.  ​
 +The following script will accomplish this by setting action to "​insert"​ when the correlation_id field is not populated:
 +<code javascript>​
 +if (current.correlation_id == null || current.correlation_id == ""​) {
 +    psp_action = "​insert";​
psp_action_in_before_share_script.txt ยท Last modified: 2016/08/18 14:20 by paul