Unable to see my gs.info or gs.log in logs table in servicenow
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎08-23-2022 06:42 AM
I have done one integration with third party tool thorugh rest message integration so that it will send some fields updates to third party tool.
Below is my script include code in which i am using code at last gs.info(responseBody); and gs.info(httpStatus);, just to check what actually its containing in body and what is the status, but its not generation any log in logs table, please suggest if i am doing somthing wrong.
I have tries gs.log also, but no go.
Script inculde code below:
sendSbDataToConga: function() {
try {
var sbRecord = [];
//var info = {};
var response = {};
var sbReq = new GlideRecord('x_amex_sourcing_request_request');
sbReq.addEncodedQuery('x_amex_sr_ready_for_conga_push=true');
sbReq.query();
var recordCount = sbReq.getRowCount();
//info["Total Number of Records"] = recordCount;
while (sbReq.next()) {
var sbRecJson = {};
sbRecJson.apttus_contract_id = sbReq.x_amex_sr_contract_id.toString();
sbRecJson.trm_emailId = sbReq.x_amex_sr_bu_trm_email_address.toString();
sbRecJson.bu_level1 = sbReq.x_amex_sr_business_unit_level_4.u_level_1.getDisplayValue().toString();
sbRecJson.bu_level2 = sbReq.x_amex_sr_business_unit_level_4.u_level_2.getDisplayValue().toString();
sbRecJson.bu_level3 = sbReq.x_amex_sr_business_unit_level_4.u_level_3.getDisplayValue().toString();
sbRecJson.bu_level4 = sbReq.x_amex_sr_business_unit_level_4.getDisplayValue().toString();
sbRecJson.countries_to = sbReq.x_amex_sr_location_of_services_to.getDisplayValue().toString();
sbRecJson.countries_from = sbReq.x_amex_sr_location_of_services_from.getDisplayValue().toString();
sbRecJson.tlm_Id = sbReq.x_amex_sr_associated_tlm_id.toString();
sbRecJson.isUsBankImpacting = sbReq.x_amex_sr_pu_bank_impacting.toString();
// sbRecJson.onboardingBuTrmName = sbReq.x_amex_sr_bu_trm_name.getDisplayValue().toString();
// sbRecJson.onboardingBuTrmEmailAddress = sbReq.x_amex_sr_bu_trm_email_address.toString();
// sbRecJson.onboardingBuL4 = sbReq.x_amex_sr_business_unit_level_4.getDisplayValue().toString();
// sbRecJson.onboardingBuTrmLeader = sbReq.x_amex_sr_bia_trm_lead.getDisplayValue().toString();
// sbRecJson.countryTo = sbReq.x_amex_sr_location_of_services_to.getDisplayValue().toString();
// sbRecJson.countryFrom = sbReq.x_amex_sr_location_of_services_from.getDisplayValue().toString();
// sbRecJson.TlmID = sbReq.x_amex_sr_associated_tlm_id.toString();
// sbRecJson.bankImpacting = sbReq.x_amex_sr_pu_bank_impacting.toString();
sbRecord.push(sbRecJson);
//To make ready_for_conga_push false after sending to Conga
sbReq.x_amex_sr_ready_for_conga_push = false;
sbReq.setWorkflow(false);
sbReq.autoSysFields(false);
sbReq.update();
}
//response = info;
response.data = sbRecord;
gs.info(JSON.stringify(sbRecord));
// gs.info('VM depts-received ' + recordCount);
var dept_data = JSON.stringify(response);
// gs.info("VM dept_data" + dept_data.replace(/\\"/g, '\\"'));
//return dept_data.replace(/\\"/g, '\\"');
var r = new sn_ws.RESTMessageV2('x_amex_sr.Conga Integration', 'post_Data_SB_to_Conga1');
r.setStringParameterNoEscape('access_token', this.generateRefreshToken());
r.setRequestBody(sbRecord);
var response1 = r.execute();
var responseBody = response1.getBody();
var httpStatus = response1.getStatusCode();
gs.info(responseBody);
gs.info(httpStatus);
} catch (ex) {
var message = ex.message;
}
},
- Labels:
-
IntegrationHub
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎08-23-2022 07:48 AM
So it seems that there is an error. Can you log the error in the catch block and advise what it says?
In the catch block just gs.info('Vikas error: ' + ex.message);
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎08-23-2022 08:18 AM
I added the log in catch block and i got this in log message
"Test error: "GlideOAuthClient" is not defined."
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎08-23-2022 09:42 AM
In your REST Message 'x_amex_sr.Conga Integration' do you have OAuth profile set in that record?
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎08-23-2022 10:08 PM
Yes , i have set 0Auth2.0 profile there