Dynamic re-direct after login based on where login was initiated

Hello,
Hoping a fellow Bubbler might have some ideas! I’m guessing it’s an easy fix, but I’m stymied.

Here’s my use case:

1. My login pop-up and workflow are in a reusable element
2. Users need to be redirected to different pages based on the button that triggered the login pop-up. Examples:
2.a. User is on index page where they see a product of interest. They click on “learn more”, which launches the login pop-up. After they either create an account or log in I would like to automatically redirect them to the correct product page.
2.b. User is on landing page and clicks on “sign up” or “log in”. After creating account or logging in I’d like to send them to their account page.

Because the sign up/log in workflow is housed in a repeating element, and not in the page that the login triggers are on, I’m not sure how to tie the state change to the “learn more” or “sign up/log in” buttons respectively and get users to the right place.

Any ideas would be greatly appreciated!
Thank you

Hi @sjoys,

Custom states defined at the root level of a reusable element are accessible from the host page. That is, workflows on the page can set the RE’s custom states. Does that help? (BTW, I assumed you meant reusable element and not repeating element.)

@sudsy Yes, that’s very helpful to know! And, yes, you’re correct, I did mean a reusable element.
Question though: How do I access the RE’s state?

So I’m imagining the workflow might go something like this…

  1. On the host page I have a workflow with the event being a button clicked when the user is not logged in
  2. The first action is to launch the Sign-In Popup
  3. The second action is to somehow reference the workflow within the Popup (I’m not sure how to actually do this…???)
  4. Then, once the user is logged in, the third action is to navigation to the product page

Would this be the correct approach, and if so, how would I reference the Popup’s workflow?
If not, thoughts on a better way?

Thank you for your help!

I tried adding a custom state to the Popup “successfully logged-in/signed-up” = yes/no, on the host page made the workflow:
if button is clicked and user isn’t logged in > open popup > navigate to product page if custom state =yes.
But, it didn’t work. I suspect because it tries to execute the navigation step before the pop-up workflow has been completed.

Thoughts?

This topic was automatically closed after 70 days. New replies are no longer allowed.