Bonding to existing records
Sometimes there is a need to receive messages from an external system for records which exist in your system, but aren't bonded in Unifi.
To do this setup an inbound create message for the target integration, this will ensure that the bond is created. Add the code below to the top of your stage to target script, before any auto generated code. It will look up the existing record and repoint Unifi to use that record instead of creating a new one.
var existing = new GlideRecord('change_request');
existing.addQuery(...); // Your look up code here - assuming other system knows ServiceNow sys_id/number
if (! {
throw 'Target record with ID ' + /*whatever you use for your id here*/ + ' not found.';
target = target.$model.getRecord();
bond.setValue('internal_reference', target.number);
Export as PDF
Copy link