Getting error ""resp" is not defined." while running code in background script
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
09-01-2022 07:17 AM
I Am trying to run below mentioned code in background script but in line no. 3 its showing me error "resp" is not defined.", please suggest how to resolve this.
responseBody = [{"isSuccess":false,"errorMessage":"Agreement: 00000288.0 is not present in Conga","apttus_contract_id":"00000288.0"},{"isSuccess":true,"errorMessage":"","apttus_contract_id":"00006475.0"}];
for(var i in responseBody){
var flag = resp[i].isSuccess;
if(!flag){
resp[i].apttus_contract_id;
gs.info('testing response For True/False');
}
}
- Labels:
-
Connect
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
09-01-2022 07:50 AM
Actually, go with what AnirudhKumar suggests.
I must be having a moment.
Add in a gs.info(responseBody[i].apttus_contract_id); to what he provided it looks good to me.
Michael D. Jones
Proud member of the GlideFast Consulting Team!
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
09-01-2022 07:34 AM
Try this:
responseBody = [{"isSuccess":false,"errorMessage":"Agreement: 00000288.0 is not present in Conga","apttus_contract_id":"00000288.0"},{"isSuccess":true,"errorMessage":"","apttus_contract_id":"00006475.0"}];
for(var i in responseBody){
var flag = responseBody[i].isSuccess;
if(!flag){
responseBody[i].apttus_contract_id;
gs.info('testing response For True/False');
}
}
