Best way to check to see if link to home page of web app contains params?


On the onPageMounted event for the initial page, I would like to check to see if the link which brought user to the initial page was a link to a story and, if so, load another page and query a record (the post id in the url params). What would be the best way to do this, and the formula for checking? I am a little confused because it doesnt seem like the best way to do this would be to always run an if/else statement on every page load. Is there a way to only trigger an event if the url does indeed contain a certain param?

To make that work you need to have a page parameter named the same as your url parameter, that means that when you open the url the parameter will be set automatically.

Then after the parameter is set, you can make the formula to check the pageparm and do what you want

but how do you check to see if it has a param and if, so, how do you extract the value param from the url in a flow function?

after the page is mounted, you can check if the parameter is empty and then you can use the parameter value as you wish.
Generally, you can access the parameter the same way as you access a page variable.

i tried. it works to check and get value and give an alert, but it will not move to another page. if i share the link to the page itself, it also does nothing but blank screen or sometimes infinite spinner

you need to make a loop in the function that you check if the parameter is empty, because it it might not have enough time for the parameter to be set.
As for the problem with the link from an other page, does it show an error page instead? and are you testing in web preview?

Because there is currently an error, which is supposed to be resolved in the next runtime version

How does one create a loop? Yes, testing in web preview.

you can use something like this