Poll Requests

Bond location and data

This script shows how to find a bond based on an external reference and store some data.

var integration = poll_request.$model.getIntegration();
var bond = new Bond(integration.getConfig());
var external_ref = 'BP-41951';

try {
  if (bond.locateReference(integration, '', external_ref, 'external')) {
    // found bond ... do your processing here

    bond.setData('key', 'abc');
    bond.setDataObject('key', {foo: 'bar'});

  } else {
    throw 'Unable to locate bond for reference "' + external_ref + '"';
  }
} catch (e) {
  log.error(e);
}