How to do X if Y happened on previous page?

So I’m trying to figure out if this is best done with custom states or extra parameters so would love some help.

On Page 1 the user clicks a button, the workflow then sends them to Page 2. If they came from Page 1 after the button had been clicked then something is triggered, once only. If they refresh Page 2 then nothing happens until they return back to Page 1 and click the button.

When I’m on the workflows for Page 2 I can’t seem to find the custom states I’m setting on Page 1.

I’ve also thought about setting a variable inside of my Current User to “On” or something if it is clicked and then switch it to “off” when it lands on Page 2 but not sure if this is optimal.

Any thoughts on how to best proceed? Thanks!

Your custom states only exist in the page they are created in (they are local variables, basically). If you want to pass some info on to the next page (without writing a value to the database – which is silly for something like this, as you note), pass it as a URL parameter.

However, I really don’t understand what it is you’re trying to do:

???

Which is another way of saying, “Why are you switching pages here anyway?” Why not just do the next thing in the same page?

(The above is a rhetorical question. I don’t want to know what it is you’re trying to do, I just want you to think about why you’re doing it in the way you’re doing it.)

At least a couple of ways.

First is the one you correctly pointed out - use a User Level field.

However the same approach can be used to update a field in another object (or create a new object upon the action).

Second way (as Keith pointed out - if you REALLY need to change the page, that is) is to use URL parameters while navigating towards the second page.

You can, for instance, send the parameter value itself, or the object id in the URL of a second page while navigating there.

Then use the workflow that would fire upon the page load, read the value of that parameter/object and do an action based on that (or skip it, if there is no parameter or the value is incorrect).

Hope this makes sense :sunglasses:

1 Like

My reason for wanting to switch page is because of the visual differences between the first and second are somewhat significant. I guess I could remain on one page and simply hide/show elements based on state but felt this would be cumbersome and ultimately messy for the long term.

@stusim Have you looked into this plugin? https://zeroqode.com/plugin/browser-session-or-local-storage-1533644028138x115153613470826500

It allows you to use Session, Local, and Cookie Storage, which would allow you to access the same data from multiple pages.

1 Like