$$BF_actions - set path not working

In my FM onRegistration script, I’m trying to redirect the user to our main marketing url after they have registered their account. I have a modal that says they were successful, then I set the variable $$BF_Action to the following:

BF_SetAction_path ( “https://oururlhere.com” ; “” )

The modal shows up, but the user is not redirected to our main url. Note, the URL is not part of the BF application.

[edit - Forgot to set the support category.]

I’ve managed to do this with a call to a named action in BF instead of a path redirect from FM. I take it that the FM $$BF_action method can only redirect to other BF app pages?

I’m now stuck with needing to show a modal then redirect the user to the company url. I’ve put a “wait” action between the modal and redirect. Is that the best way to do it? There’s an “OK” button on the modal; I was hoping that could trigger the redirect. I’m not sure how to access that click.

If you take a look at the documentation for the path action, you’ll see that additional options are required if you want to use a URL (external) instead of a path (internal).

The BF_SetAction_path custom function simply provides a shortcut for generating the JSON object noted in the documentation. If you put that function in the FileMaker Data Viewer, you can experiment and see how to add the option that you need, but I believe this will work for your use case:

BF_SetAction ( "path" ; JSONSetElement ( "{}" ; [ "url" ; "https://google.com" ; JSONString ] ) )

Use a similar technique for adding actions to buttons. If you know how to build the object in the BF editor, simply use the JSON functions in FileMaker to build that same object on the FM side.

2 Likes

Thanks Eluce! I didn’t realize that the FM BF_SetAction worked that way. Good to know! If this is explained in the docs, I didn’t see it.