Changing Path Depending on Model

Jeremy Leong:
Hi all, how do I set the action up such that, if say model.status = “New”, it goes to slug “newRecord”, and if model.status = “Confirmed” it will go to another slug?


Neil Manchester:
Use a function within your path snippet

{
    "action": "path",
    "function": "if (model.status=='New') {\n    action.options.path = '/newRecord';\n} else if (model.status == 'Confirmed'){\n    action.options.path = '/otherSlug';\n}"
}

The path can then be set using action.options.path using an if statement


Jeremy Leong:
woah thanks Neil, you’re always the one saving me :slightly_smiling_face:


Neil Manchester:
No problems. All stuff that the BF team have taught me how to do over the years :joy:


Jeremy Leong:
how long hve you been working using BF?


Neil Manchester:
I did my first session with Charles during the first COVID lockdown. I’ve spent the last 18 months full rebuilding my FileMaker Vertical Market solution so it’s now a full BF front end and new supporting FileMaker backend so I’ve spent pretty much everyday for the last year and a half using it. Still learning!!


Jeremy Leong:
That’s inspiring to hear. I will try to keep up the best I can