Hello,
I have a Web API configured to trigger when a process model encounters a failure. The logic to detect the failure in the API's body section is as follows:
error_code: if(fv!processInfo.pv.success, fv!processInfo.pv.errorCode),
error_description: if(fv!processInfo.pv.success, fv!processInfo.pv.errorMessage, "Failure in process model")
The issue I'm facing is that the process model executes successfully — no errors occur, and I receive the expected data in the response. However, the API still returns the error message: "Failure in process model". Also, the errorCode and errorMessage passed from the process model are empty.
errorCode
errorMessage
Could anyone help me understand why this is happening? Is there something wrong with how the condition is structured? Keep in mind it used to work prev and is working perfectly in other processes/web APIs?
Discussion posts and replies are publicly visible
What is the value in pv!success in your process? you mentioned the pv!errorCode and pv!errorMessage are empty - that sounds correct given process had no errors.
You need to ensure that if no errors are there the pv!success should have true() in it. If its null or empty then the if conditions will evaluate to false - hence the message "Failure in process model" always
Also check the below line, if statement is missing one parameter here - it is a syntax error before anything else! May be its just here for the question like this yet worth highlighting this isn't right.
hawraj9694 said:error_code: if(fv!processInfo.pv.success, fv!processInfo.pv.errorCode),
Sure. Your logic is not correct, and your code should look more like this:
error_code: if(fv!processInfo.pv.success, null, fv!processInfo.pv.errorCode), error_description: if(fv!processInfo.pv.success, null, fv!processInfo.pv.errorMessage)
Check your if sentences... they are not correct ...