IF Condition using Liquid Template in Twilio Studio

66 Views Asked by At

I have the following message:

La instalación del TPV se realizará las próximas 72 horas laborables.

¡Muchas gracias por completar la confirmación de datos!

*Resumen del formulario.*
{%- if flow.variables.flagCantidadTPV \> 0 %}
*Cantidad de TPV(s)*: {{flow.variables.cantidadOriginal}}
{% else %}
*Cantidad de TPV(s)*: {{flow.variables.cantidad}}
{%- endif %}

*Los datos de su comercio:*
*{{widgets.funcionDameDatosComercio.parsed.data.NOMBRE_COMERCIO}}*
*Dirección comercio*: {{flow.variables.direccionEditada}}
*Codigo Postal*: {{flow.variables.codigoPostalEditado}}
*Localidad*: {{flow.variables.localidadEditada}}
*Provincia*: {{flow.variables.provinciaEditada}}
*Días de apertura:* {{widgets.funcionDia.parsed.diaSeleccionado}}
{%- if  flow.variables.tipoHorario == 'Horario continuo' %}
*Horarios:* De {{flow.variables.HORA1}} a {{flow.variables.HORA2}}
{%- else %}
*Horarios:* De {{flow.variables.HORA1}} a {{flow.variables.HORA2}} y {{flow.variables.HORA3}} a {{flow.variables.HORA4}}
{%- endif %}

1️⃣ Continuar, la información es correcta. 2️⃣ Reiniciar el formulario.

The snippet in the code block does not work, in the Twilio flow I save the variables, but when I want to do the validation to show message X or message Y, it is not evaluating the condition correctly. Example. if 5 > 4 : true but apparently it does not evaluate the condition and always enters the else

enter image description here

1

There are 1 best solutions below

2
On

The example you provided includes lines that do not appear to be valid Liquid:

{%- if flow.variables.flagCantidadTPV \> 0 %}

...

{%- if  flow.variables.tipoHorario == 'Horario continuo' %}

Does correcting to this work?

{%- if {{flow.variables.flagCantidadTPV}} > 0 %}

...

{%- if {{flow.variables.tipoHorario}} == 'Horario continuo' %}