Skip to content

TransactionManager

runIntegration()

Runs the specified Integration synchronously.

NameTypeDescription
grGlideRecordRecord that will be used as the Integration's initRecord.
integrationIdstringThe sys_id of the Integration.
operation"insert" | "update" | "delete"The operation that triggered the integration.
initialInputsRecord<string, any>|undefinedAn object that can be used to pass initial inputs to the Integration
  • Type

    ts
    function runIntegration(
      gr: GlideRecord,
      integrationId: string,
      operation: 'insert' | 'update' | 'delete',
      initialInputs: Record<string, any> | undefined,
    ): Record<string, any>;
    function runIntegration(
      gr: GlideRecord,
      integrationId: string,
      operation: 'insert' | 'update' | 'delete',
      initialInputs: Record<string, any> | undefined,
    ): Record<string, any>;
  • Example

js
(function process(/*RESTAPIRequest*/ request, /*RESTAPIResponse*/ response) {
  // create an inbound http request that will be used as the Integration's initRecord
  var gr = new GlideRecord('x_devol_intgr_mgr_inbound_http_request');
  gr.setValue('headers', JSON.stringify(request.headers));
  gr.setValue('body', JSON.stringify(request.body.data));
  gr.setValue('query', JSON.stringify(request.queryParams));
  gr.setValue('uri', request.uri);
  gr.setValue('url', request.url);
  gr.setValue('method', 'post');

  gr.insert();
  // define the configuration for the Integration
  var integrationId = 'integration_sys_id_goes_here'; // replace the placeholder with the integration's sys_id
  var operation = 'insert'; // which operation to pass to the integration
  var initialInputs = {}; // this can be used to provide some initial data that will be available as inputs for the first step
  // run the integration synchronously
  var result = x_devol_intgr_mgr.TransactionManager.runIntegration(
    gr,
    integrationId,
    operation,
    initialInputs,
  ); // this will return the outputs of the last step in the integration
  response.setStatus(201);
  response.setBody(result);
})(request, response);
(function process(/*RESTAPIRequest*/ request, /*RESTAPIResponse*/ response) {
  // create an inbound http request that will be used as the Integration's initRecord
  var gr = new GlideRecord('x_devol_intgr_mgr_inbound_http_request');
  gr.setValue('headers', JSON.stringify(request.headers));
  gr.setValue('body', JSON.stringify(request.body.data));
  gr.setValue('query', JSON.stringify(request.queryParams));
  gr.setValue('uri', request.uri);
  gr.setValue('url', request.url);
  gr.setValue('method', 'post');

  gr.insert();
  // define the configuration for the Integration
  var integrationId = 'integration_sys_id_goes_here'; // replace the placeholder with the integration's sys_id
  var operation = 'insert'; // which operation to pass to the integration
  var initialInputs = {}; // this can be used to provide some initial data that will be available as inputs for the first step
  // run the integration synchronously
  var result = x_devol_intgr_mgr.TransactionManager.runIntegration(
    gr,
    integrationId,
    operation,
    initialInputs,
  ); // this will return the outputs of the last step in the integration
  response.setStatus(201);
  response.setBody(result);
})(request, response);