Happy Business Starts Here

Workflow Liquid “If” condition issue for different data types

Goutham
Zuora Support

Workflow Liquid “If” condition issue for different data types

Problem:

In the Workflow “If” task, the same values (Value1 and Value2) are passed in checking the “>” greater than condition as mentioned in the below code, the expected result is FALSE. But Liquid returns TRUE

 

{% if Data.Value1 > Data.Value2 %}
True
{% else %}
False
{% endif %}

 

Solution:

It is noted that the liquid code’s behavior changes with respect to the Data type of the value, in this case, Value1 is a float and Value2 is an integer.

For this scenario, we can use rounding in liquid code to remove the decimal places and get the expected result- https://shopify.github.io/liquid/filters/round/
LiquidIFcond.jpg