Multiple paths to and from a single button

Hey Figma folks. I’m trying to figure out how to get from
• Page A to modal X clicks Submit goes to Page B
• Page C to modal X clicks Submit goes to Page D
• Page E to modal X clicks Submit goes to Page F

Depending on the page the user came from, clicking the same button on the modal would shuffle the user to a different page.

You can use variables.

  1. Create a string variables (e.g: fromPage)
  2. Before the “Navigate to” on your CTA’s interaction, from page A,C and E, set your variable fromPage to the name of your current page
    So if you click on the CTA from page A
Set variable fromPage to "A"
Navigate to Modal X
  1. On the CTA, from modal X, add some conditions that will check fromPage and depending on its value, navigate to the desired page
if fromPage == "A"
  Navigate to Page B
if fromPage == "C"
  Navigate to Pace D
...

let me know if it helped