Expression evaluation error at function a!fromJson: The jsonText parameter was not valid JSON.) (Logic Output)

Certified Associate Developer

Hi All,

One of the if conditions in a XOR gate is defined as follows and the output is getting written to a DS entity. However, this code is getting stuck at the XOR gate level itself giving the error as below. Please advise:

Error: An error occurred while evaluating expression: =a!localVariables( local!statusCode: if( rule!APN_isBlank( pv!RMO_CDT_TxnLog.responseMessage ), "400", a!fromJson( pv!RMO_CDT_TxnLog.responseMessage ).StatusCode), and( or( local!statusCode = "0", local!statusCode = "200" ), pv!Result.statusCode = "200" )) (Expression evaluation error at function a!fromJson: The jsonText parameter was not valid JSON.) (Logic Output)


Code configured in XOR gate:

= a!localVariables(
local!statusCode: if(
rule!APN_isBlank(pv!RMO_CDT_TxnLog.responseMessage),
"400",
a!fromJson(pv!RMO_CDT_TxnLog.responseMessage).StatusCode
),
and(
or(
local!statusCode = "0",
local!statusCode = "200"
),
pv!Result.statusCode = "200"
)
)




Thanks.

  Discussion posts and replies are publicly visible

Parents
  • Hello, that error is occurring because, as the message says, it's trying to convert a json value but receiving a non-json value (pv!RMO_CDT_TxnLog.responseMessage).

    What you could do here is:

    1. Have some other verification before the fromJson, such as checking if the success result of "Send Details of CRM" is true, or;
    2. Inside the integration, change the Response Body Parsing from "Return raw response body" to "Convert JSON to Appian value". This ensures the the result is already parsed and there's no need to use the a!fromJson()
Reply
  • Hello, that error is occurring because, as the message says, it's trying to convert a json value but receiving a non-json value (pv!RMO_CDT_TxnLog.responseMessage).

    What you could do here is:

    1. Have some other verification before the fromJson, such as checking if the success result of "Send Details of CRM" is true, or;
    2. Inside the integration, change the Response Body Parsing from "Return raw response body" to "Convert JSON to Appian value". This ensures the the result is already parsed and there's no need to use the a!fromJson()
Children
No Data