Bonding to existing records
var existing = new GlideRecord('change_request');
existing.addQuery(...); // Your look up code here - assuming other system knows ServiceNow sys_id/number
existing.query();
if (!existing.next()) {
throw 'Target record with ID ' + /*whatever you use for your id here*/ + ' not found.';
}
target.$model.setRecord(existing);
target = target.$model.getRecord();
bond.setTarget(target.$model);
bond.setValue('internal_reference', target.number);
transaction.$model.setTarget(target);
bond.shouldCommitTarget(false);
bond.commit();
bond.shouldCommitTarget(true);Last updated
Was this helpful?
