ww-sam
ww-sam

Reputation: 1

Logic App Boolean Expression True not true

I have a Logic App expression that evaluates the condition correctly, but outputs True instead of true.

A subsequent POST HTTP action fails as the JSON payload that contains this value cannot parse True and requires true.

Key-value pair containing the expression:

"apiTicket": @{equals(body('Get_Ticket_Details')?['takenby'], 'Integration Agent')}

Runtime output:

"apiTicket": True

Error:

{
  "error": {
    "code": "InvalidRequestContent",
    "message": "The request content is not valid and could not be deserialized: 'Unexpected character encountered while parsing value: T. Path 'params.apiTicket', line 15, position 17.'."
  }
}

Microsoft reference guide states the equals function should return true or false, not True or False

https://learn.microsoft.com/en-us/azure/logic-apps/workflow-definition-language-functions-reference#equals

I understand how to work around this error, but does anyone know why this function works like this?

Upvotes: 0

Views: 34

Answers (1)

RithwikBojja
RithwikBojja

Reputation: 11383

Logic App equals() function gives True and False as the answer and not as true or false.

To overcome this you can simply you tolower() function as below:

Here, I have taken manually as True for apiTicket. You can use it dynamic value:

enter image description here

Change it to:

"apiTicket": tolower(equals(body('Get_Ticket_Details')?['takenby'], 'Integration Agent'))

Output:

enter image description here

Upvotes: 0

Related Questions