How to resolve "maximum number of outbound HTTP requests exceeded" errors in ServiceNow integration

This article describes a known issue with previous versions of the xMatters - ServiceNow integration. This issue has been resolved in the latest version of the integration.

 

 

 

Batch sync process issues 

Some versions of the ServiceNow integration were subject to group batch sync failures accompanied by the following message in the ServiceNow user interface:

"Transaction canceled - maximum number of outbound HTTP requests exceeded"

This issue occurs when the background worker responsible for the batch group sync exceeds limitations. To resolve this issue, you can modify the integration to spread the load among multiple background workers.

To resolve this problem:

  1. Log on to the ServiceNow user interface.
  2. Click the Type filter text field, and then type xMatters.
  3. In the Integration-xMatters section of the returned search results, under the Script Includes heading, click xMattersBackgroundBatchSync.
  4. Find the line that starts "this.MAX_SOAP_CALLS_PER_PROCESS" and change the value to 10.
  5. Click Save.

 (xMatters reference: DTN-5156 Originally by Jeremy Brown)

Dynamic sync process issues

Some versions of the ServiceNow integration may also have been subject exceeding the HTTP request limits while syncing users dynamically - a process that occurred in the foreground. To avoid this limitation, ensure that all syncing operations are performed in background worker processes.

Step One

Add the following method at the bottom of the xMattersUserSync Script Include (x_xma_xmatters.xMattersUserSync):

/**
* Synchronize the user with xMatters
* @param currentName name of the user being modified
* @param userName name of the user being modified (could be previous)
* @param triggerRule String defining the action to take
* @param updateDevices If true, then devices need to be updated
* @return none
*/
syncUserAndDevicesFromBR : function(currentName, userName, triggerRule, updateDevices) {
this.log.debug("syncUserAndDevicesFromBR - currentName: " + currentName);
var userRec = new GlideRecord('sys_user');
userRec.get('user_name', currentName);
if (userRec) {
this.log.debug("syncUserAndDevicesFromBR - Found User: " + userRec.getUniqueValue());
var syncd = this.syncUser(userRec, userName, triggerRule);
if (syncd == "true" && updateDevices) {
this.log.debug("syncUserAndDevicesFromBR - About to updateDevices for User: " + currentName);
this.syncDevices(userRec);
}
} else {
this.log.debug("syncUserAndDevicesFromBR - Could not find user with currentName: " + currentName);
}
}

Step Two

Add the following helper function to the bottom of the xMatters User Sync business rule:

/**
* Synchronize the user in a separate worker process.
* @param record the current user record
* @param userName name of the user being modified
* @param triggerRule String defining the action to take
* @param updateDevices boolean is true if devices need to be updated
* @return nothing
*/
function syncUserAndDevicesAsync(record, userName, triggerRule, updateDevices) {
var worker = new GlideScriptedHierarchicalWorker();

 // This is the name of the worker in the sys_progress_worker table.
  worker.setProgressName("User Sync Bus Rule Worker");

// Instantiate the ScriptInclude and indicate which method to fire
// The parameters are passed in order, not by name, so the first
// value of that putMethodArg is not used.
  worker.setScriptIncludeName(appPrefix + '.' + "xMattersUserSync");
worker.setScriptIncludeMethod("syncUserAndDevicesFromBR");
worker.putMethodArg("currentName", record.user_name);
worker.putMethodArg("userName", userName);
worker.putMethodArg("triggerRule", triggerRule);
worker.putMethodArg("updateDevices", updateDevices);

worker.setBackground(true);
xMlog.debug("syncUserAndDevicesAsync - About to start background worker for: " + record.user_name);
worker.start();

return worker.getProgressID();
}

 

Step Three

Change the body of the User Sync business rule to call the helper method:

/*
// Update the user in xMatters
if (current.operation() == "update") {
syncd = userSync.syncUser(current, previous.user_name, "UpdateUser");
if (!seedOnly && syncd == "true") {
syncDevices(current, previous, userSync);
} else {
xMlog.debug("Users devices will not be synchronized as the user was not synchronized");
}
} else if (current.operation() == "insert") {
// Inject the user into xMatters
syncd = userSync.syncUser(current, current.user_name, "AddUser");
if (syncd == "true") {
syncDevices(current, previous, userSync);
} else {
xMlog.debug("Users devices will not be synchronized as the user was not synchronized");
}
} else if (current.operation() == "delete") {
// Delete the user from xMatters
userSync.syncUser(current, current.user_name, "DeleteUser");
}
*/

// Update the user in xMatters
var jobId;
if (current.operation() == "update") {
var updateDevices = current.email.changes() || current.phone.changes() || current.mobile_phone.changes();
jobId = syncUserAndDevicesAsync(current, previous.user_name, "UpdateUser", updateDevices);
xMlog.debug("jobId from call to syncUserAndDevicesAsync: " + jobId);

} else if (current.operation() == "insert") {
// Inject the user into xMatters
 jobId = syncUserAndDevicesAsync(current, current.user_name, "AddUser", true);
xMlog.debug("jobId from call to syncUserAndDevicesAsync: " + jobId);

} else if (current.operation() == "delete") {
// Delete the user from xMattersjobId = syncUserAndDevicesAsync(current, current.user_name, "DeleteUser", false);
xMlog.debug("jobId from call to syncUserAndDevicesAsync: " + jobId);
}

 

 

 

 

 

Have more questions? Submit a request

0 Comments

Article is closed for comments.
Powered by Zendesk