response.status or response.statusmessage

akin9
Tera Contributor

Hello Exports,

we have created rest message for add the users on ADM group, our script is working fine for success.

but if users not added also we are getting the success.

how do i define

if condition for respone. (response status" 0 " or response status message. for failure ).

below

 

var response = r.execute();
var responseBody = response.getBody();
var httpStatus = response.getStatusCode();




if (httpStatus == '200') {
workflow.scratchpad.responsestatus = 'success';
workflow.scratchpad.response = ' Access granted';
}
else {
workflow.scratchpad.responsestatus = 'failed';
workflow.scratchpad.response = 'Failed to add. Below is the response. \n'+JSON.stringify(responseBody);

 

akin9_0-1675229472527.png

 

0 REPLIES 0