- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
09-06-2022 03:32 AM
I am doing one rest message integration and in the script include i have written the code to send all the fields data to 3rd party toll.
I have created one if condition in which it will make sure that no duplicate ContractID along with the corresponding sys id will not enter in the array object, it is basically used to handle the duplication of contract id.
But now in the response getting error "[{"isSuccess":true,"errorMessage":"","apttus_contract_id":"00006475.0"}]" , my question is like why its showing error in the response , how not to get the error, my script is working fine as its not entering the duplicate data in array but response shows the error , how not to get error.
Below is my script:
var AXP_Apttus_Integration_Utils = Class.create();
AXP_Apttus_Integration_Utils.prototype = {
initialize: function() {},
//Below function is used to update the data to APTTUS from SB record
sendSbDataToApttus: function() {
try {
var sbRecord = [];
var sbRecordSysIds = [];
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();
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();
if (sbReq.x_amex_sr_pu_bank_impacting.toString().toLowerCase() == 'yes') {
sbRecJson.isUsBankImpacting = true;
} else {
sbRecJson.isUsBankImpacting = false;
}
if (sbRecordSysIds.toString().indexOf(sbRecJson.apttus_contract_id.toString()) == -1){
sbRecord.push(sbRecJson);
sbRecordSysIds.push(sbReq.sys_id.toString() + " " + sbRecJson.apttus_contract_id.toString());
gs.info('combination ' + sbRecordSysIds);
//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();
}
}
Solved! Go to Solution.
- Labels:
-
Integrations
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
09-06-2022 04:00 AM
Thats the standard format of response since isSuccess is true it is successful and error message is empty
If isSuccessful is false then there will be some message in error message saying why it is not successful
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
09-06-2022 03:37 AM
As you can see error message is empty that means there is no error
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
09-06-2022 03:44 AM
If there is no error then why it showing me the error statement, it should simply say Is Suucsfull true and my contract id
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
09-06-2022 04:00 AM
Thats the standard format of response since isSuccess is true it is successful and error message is empty
If isSuccessful is false then there will be some message in error message saying why it is not successful
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
09-06-2022 03:46 AM
Hi,
are you saying why the response body has this errorMessage":"" in it?
If yes then I believe it will be there.
If it's success it will be empty
If it's failure it will be populating the error message why it failed.
regards
Ankur
Ankur
✨ Certified Technical Architect || ✨ 9x ServiceNow MVP || ✨ ServiceNow Community Leader