Web Service Consumer and Commit Changes

UnoZ06
Tera Contributor

Working on this business rule now learning but when I go to the log file after executing the updates to the required table there is no log file to confirm it is completed. What am I doing wrong?

 

Instance information is taken out but here is Business rule as written in the training:

 

(function executeRule(current, previous /*null when async*/ ) {

if (current.item_type == "cmdb_ci_computer") {

var request = new sn_ws.RESTMessageV2();
request.setEndpoint('https://nowlearning-nlinst010-test-001.lab.service-now.com/api/now/table/u_password_vault?sysparm_qu...' + current.cmdb_ci.asset_tag + '&sysparm_fields=u_password&sysparm_limit=1');
request.setHttpMethod('GET');

//Eg. UserName="admin", Password="admin" for this code sample.
var user = 'admin';
var password = '';

request.setBasicAuth(user, password);
request.setRequestHeader("Accept", "application/json");

var response = request.execute();
gs.info(response.getBody());

var obj = JSON.parse(response.getBody());
var myPass = obj.result[0].u_password;
gs.info('u_password: ' + myPass);

}
})(current, previous);

2 REPLIES 2

gstinsonjr42
Tera Contributor

Hello< I am currently having this same issue. Did you ever figure out what was going wrong for you?

No, unfortunately, I didn't and I just moved on. It was very nerve-wracking trying to figure out what went wrong.