I have added one condition in JS. If one value in the incoming request payload coming as null then it will set a flow variable's value in that variable. But that condition for null checking is not working.
It is returning 500 error.
var jPayload = JSON.parse(getPayload);
if(jPayload.systemId)
{
var systemId= jPayload.systemId;
if((jPayload.systemId === "0") || (jPayload.systemId === " ") || (jPayload.systemId === null))
{ systemId = var1;
}else
{ systemId= systemId;
}
}
Note: systemId is a key in incoming json payload.
.....
500 error could indicate lots of things.
One possibility is that the JSON.parse() is failing, because the "getPayload" thing is not json.
To diagnose, examine Apigee trace; that sometimes will give you clues.
If not, surround your code in try...catch... and you can set context variables appropriately. This should give you some insight.