0

[ServiceNow] ERROR: Cannot find default value for object

I'm having a really strange problem here as far as I can tell. I am building out some customization on top of the ServiceNow Integration which will run some checks and ultimately sync the manager of the group from MAX into the Default Shift of xMatters.

To do this, it first needs to grab the members from the default shift, because we only want to perform this action if the shift is empty. It will then use that response to run some logic checks and then proceed. However, I am getting hung up on the GET request. The thing that makes it strange is that the request is using 

var res = this.dataHelper.get(path);

The reason this is weird is because I put in a debugger into that actual function and was able to see the entire object response but for some reason its broken by the time it returns to the function which calls it. Below is a breakdown of my code along with the errors I am receiving.

 

xMattersGroupMembership (triggered when adding xMatters role to group)

(custom function) syncManagerToDefaultShift: function (groupName, manager_xm_id) {

var path = '/groups/' + encodeURIComponent(groupName) + '/shifts/Default Shift/members';
var res = this.dataHelper.get(path);

this.log.debug('*** DATA: ' + data);


It fails by the time it gets to the debugger, but in the actual dataHelper.get function, I can see that the response is valid.

 

Below is what the actual dataHelper function is followed by my debugging edit which shows me that the response is valid:

 

get: function (route, params) {
var path = this.baseURL + route;

if (params) {
for (var k in params) {
if (params.hasOwnProperty(k)) {
path += path.indexOf('?') === -1 ? '?' : '&';
path += encodeURIComponent(k) + '=' + encodeURIComponent(params[k]);
}
}
}

return this.sendRequest({
method: 'GET',
path: path
});
},
get: function (route, params) {
var path = this.baseURL + route;

if (params) {
for (var k in params) {
if (params.hasOwnProperty(k)) {
path += path.indexOf('?') === -1 ? '?' : '&';
path += encodeURIComponent(k) + '=' + encodeURIComponent(params[k]);
}
}
}

var res = this.sendRequest({method: 'GET', path: path)};

this.log.debug('**** ' + JSON.stringify(res));
},

 

Full Error 

[1562944661779 | xMLog-27c87b52]:
xMatters Group Sync BR: TypeError: Cannot find default value for object.
* fileName: sys_script_include.c8a205cb7b02f1008e0b707d784d4dbc.script
* sourceName: sys_script_include.c8a205cb7b02f1008e0b707d784d4dbc.script
* lineNumber: 131
* stack: at sys_script_include.c8a205cb7b02f1008e0b707d784d4dbc.script:131 (anonymous)
at sys_script_include.d6d8ed614f4712008472a88ca310c757.script:328 (anonymous)
at sys_script_include.d6d8ed614f4712008472a88ca310c757.script:124 (anonymous)
at sys_script.1fca1e074fb4c2008472a88ca310c700.script:25 (onAfter)
at sys_script.1fca1e074fb4c2008472a88ca310c700.script:1
at sys_ui_action.42da42d00a0a0b340066377beb6dd099.script:1

* rhinoException: TypeError: Cannot find default value for object. (sys_script_include.c8a205cb7b02f1008e0b707d784d4dbc.script; line 131)

6 comments

Please sign in to leave a comment.