Skip to main content
October 26, 2021
Question

Cannot index property 'messages' of type Text into type Text ?

  • October 26, 2021
  • 4 replies
  • 0 views

if(
fv!success,
if(
/*In the response, if the resultCode parameter is "Error,"
or the errors parameter is not null,
return false*/
or(
fv!result.body.messages.resultCode = "Error",
not(
isnull(
fv!result.body
)
)
),
false,
true
),
false
)

The API response I am getting 

HttpResponse statusLine: "HTTP/1.1 200 OK" statusCode: 200 headers: Dictionary Cache-Control: "no-store" Pragma: "no-cache" Content-Type: "application/json; charset=utf-8" X-OPNET-Transaction-Trace: "9d4ed313-4f4e-4699-9a26-8192fc4fabcb-3288-74350853" Access-Control-Allow-Credentials: "true" Access-Control-Allow-Headers: "x-requested-with,cache-control,content-type,origin,method,SOAPAction" Access-Control-Allow-Methods: "PUT,OPTIONS,POST,GET" Access-Control-Allow-Origin: "*" Strict-Transport-Security: "max-age=31536000" X-Cnection: "close" Date: "Tue, 26 Oct 2021 08:59:16 GMT" Content-Length: "478" contentType: "application/json; charset=utf-8" body: "{"transactionResponse":{"responseCode":"3","authCode":"","avsResultCode":"P","cvvResultCode":"","cavvResultCode":"","transId":"0","refTransID":"","transHash":"","testRequest":"0","accountNumber":"XXXX0015","accountType":"MasterCard","errors":[{"errorCode":"8","errorText":"The credit card has expired."}],"transHashSha2":"","SupplementalDataQualificationIndicator":0},"messages":{"resultCode":"Error","message":[{"code":"E00027","text":"The transaction was unsuccessful."}]}}"

I am getting this error

error-result-label

Error processing integration response

error-result-guidance

The success criteria expression could not be evaluated Expression evaluation error at function 'or' [line 26]: Invalid index: Cannot index property 'messages' of type Text into type Text

Thanks,
Minhaj

4 replies

stefanhelzle0001
Brainy
October 26, 2021
October 26, 2021

the above doc url didn't help

stefanhelzle0001
Brainy
October 26, 2021

An API returns the data as JSON in pure text. To turn that into a data structure, you need to enable Automatic Parsing. Then you can use the dot-notation to navigate into the result.