How do nested conditionals work in flows?
1

I am trying to make a nested condition in my Flow: "(${form.months} ​​​​== 1) || (${form.months} ​​​​== 2) but if I write it this way it does not validate any condition, instead if I write it like this simple (${form.months} ​​​​== 1) it works, what are you doing wrong?

Johana
Đã hỏi khoảng 2 tháng trước
Johana

I'm following this documentation https://developers.facebook.com/docs/whatsapp/flows/reference/components#if but I don't understand why it doesn't work for me

30 tháng 8 lúc 10:28
Bar

Can you please paste your entire Flow JSON? It would help debug

30 tháng 8 lúc 10:36
Câu trả lời được chọn
1

Hi Johana,

The issue has been fixed. You can now use conditional rendering with "(${form.months} ​​​​== 1) || (${form. months} ​​​​== 2)".

Please verify and let us know if you are still facing this issue.

Thanks

5 tháng 9 lúc 05:34
Sukhbir
Câu trả lời được chọn
1

I am not allowed to post the full json

30 tháng 8 lúc 11:14
Johana
Johana
{
            "id": "PET_AGE",
            "title": "Edad",
            "terminal": true,
            "layout": {
                "type": "SingleColumnLayout",
                "children": [
                    {
                        "type": "Form",
                        "name": "pet_age_form",
                        "children": [
                            {
                                "type": "TextInput",
                                "label": "Escribe",
                                "name": "months",
                                "input-type": "number",
                                "required": true
                            },
                            {
                                "type": "If",
                                "condition": "(${form.months} == 1) || (${form.months} == 2)",
                                "then": [
                                    {
                                        "type": "TextBody",
                                        "text": "Lo sentimos, pero no podemos continuar con la información proporcionada"
                                    },
                                    {
                                        "type": "Footer",
                                        "label": "Regresar",
                                        "on-click-action": {
                                            "name": "complete",
                                            "payload": {}
                                        }
                                    }
                                ],
                                "else": [
                                    {
                                        "type": "TextBody",
                                        "text": "Good" 
                                    },
                                    {
                                        "type": "Footer",
                                        "label": "Continuar",
                                        "on-click-action": {
                                            "name": "complete",
                                            "payload": {}
                                        }
                                    }
                                ]
                            }
                        ]
                    }
                ]
            }
        }
30 tháng 8 lúc 11:19
Sukhbir

Hello Johana, Thank you for reaching out. It appears that this is an issue on our end, and we are currently working to resolve it. In the meantime, as a temporary solution, could you try using a single point comparison in the if condition and then having another comparison in the else condition? I understand that this may require writing more JSON for your use case, but it should work for now. Please let us know if you have any further questions or concerns.

Also, I am adding the JSON for your reference.

1 tháng 9 lúc 05:10
Sukhbir

{ "version": "5.0", "screens": [ { "data": { "value": { "type": "boolean", "example": true } }, "id": "SCREEN", "layout": { "type": "SingleColumnLayout", "children": [ { "type": "Form", "name": "pet_age_form", "children": [ { "type": "TextInput", "label": "Escribe", "name": "months", "input-type": "number", "required": true }, { "type": "If", "condition": "(${form.months} == 1)", "then": [ { "type": "TextBody", "text": "Lo sentimos, pero no podemos continuar con la información proporcionada" }, { "type": "Footer", "label": "Regresar", "on-click-action": { "name": "complete", "payload": {} } } ], "else": [ { "type": "If", "condition": "(${form.months} == 2)", "then": [ { "type": "TextBody", "text": "Lo sentimos, pero no podemos continuar con la información proporcionada" }, { "type": "Footer", "label": "Regresar", "on-click-action": { "name": "complete", "payload": {} } } ], "else": [ { "type": "TextBody", "text": "Good" }, { "type": "Footer", "label": "Continuar", "on-click-action": { "name": "complete", "payload": {} } } ] } ] } ] } ] }, "title": "Welcome", "terminal": true, "success": true } ] }

1 tháng 9 lúc 05:10
Johana

Ok but there is a drawback since I need to specify that the client does not write 0, 1, 2 or 3 and if I nest this way I can only nest three times and not four. What can I do?

2 tháng 9 lúc 08:53