I have a service task which calls a REST API; the API is returning the following JSON:
{
"success": true,
"message": null,
"details": [],
"errors": [],
"transactions": []
}
The service task has a JavaScript output parameter to process the JSON output:
var statusCode = connector.getVariable("statusCode");
if (statusCode != 200) {
throw new Error(connector.getVariable("response"));
}
else {
var output = S(connector.getVariable("response"));
output.prop("success").value==true; // Problem line
}
I have sent the output
to a process variable and confirmed that it contains the JSON above. However, I cannot get this output to ever register as true
for the subsequent forking of the process. I have tried all of the following:
output.prop("success");
output.prop("success").value;
output.prop("success").value==true;
output.prop("success").value===true;
output.prop("success").value=="true";
Can anyone help with getting this right?