Join the #BuildWithBuildAgent Challenge! Get recognized, earn exclusive swag, and inspire the ServiceNow Community with what you can build using Build Agent.  Join the Challenge.

Getting error ""resp" is not defined." while running code in background script

VIKAS MISHRA
Tera Contributor

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');
        }
    }

 

find_real_file.png

6 REPLIES 6

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. 

 
I hope this helps!
Michael D. Jones
Proud member of the GlideFast Consulting Team!

AnirudhKumar
Mega Sage

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');
        }
    }