Get previous step
Function: Get previous step
This action helps you find the unique identifier (code) of the step that comes before the currently active step in a Stepper UI element on your page. It's useful for navigating backward in multi-step processes or implementing logic based on the user's previous position.
Input
- Stepper UI Element:
Specify the Stepper UI element on your page from which you want to retrieve the previous step's code. This is a required input.
- Type: UI Element (specifically a Stepper)
Output
- Result:
The unique identifier (code) of the previous step. This value will be stored in a variable you specify, or in a default variable named 'PREVIOUS_STEP'.
- Type: Number
Execution Flow
Real-Life Examples
Here are some practical ways you can use the "Get previous step" action:
Example 1: Navigating back in a multi-step application form
Imagine you have a multi-step application form (e.g., for a loan or job application) built with a Stepper UI element. When a user clicks a "Back" button, you want to automatically move them to the previous step.
- Inputs:
- Stepper UI Element:
LoanApplicationStepper
(the Stepper UI element on your page)
- Stepper UI Element:
- Result:
The numerical code of the step immediately preceding the current one (e.g.,
2
if the user was on step3
) is stored in thePREVIOUS_STEP
variable. You can then use another action, like "Set Stepper Step," to navigate to the step identified byPREVIOUS_STEP
.
Example 2: Displaying a specific message when returning to a review section
Consider an e-commerce checkout process where users can review their order before confirming. If a user goes back from the "Payment" step to the "Review Order" step, you might want to display a reminder message.
- Inputs:
- Stepper UI Element:
CheckoutStepper
(your checkout Stepper UI element)
- Stepper UI Element:
- Result:
The numerical code of the previous step (e.g.,
3
if the user was on step4
) is stored in thePREVIOUS_STEP
variable. You can then use a conditional action:IF PREVIOUS_STEP is "3" THEN Show Message "Please double-check your order details before proceeding to payment."
Example 3: Tracking user progress in a setup wizard
For a new user onboarding or product setup wizard, you might want to log or track which step a user was on before they decided to go back.
- Inputs:
- Stepper UI Element:
OnboardingWizard
(the Stepper UI element for your wizard)
- Stepper UI Element:
- Result:
The numerical code of the step the user was on before moving back (e.g.,
1
if they were on step2
) is stored in thePREVIOUS_STEP
variable. This value can then be used to update a user's progress record in your database or send an analytics event.