What is Stop Journey?
As the name suggests, the Stop Journey action terminates the execution of a journey from the point at which it is placed by the user. The Stop Journey action can be placed anywhere in the Steps section, i.e., between simple actions or business logic such as if condition, if-else condition, for-each condition, or try-catch block depending on the user's business requirement is.
Benefits of using Stop Journey
A journey could have more than 100 actions in it. The more extensive the journey is, the execution and response time will get long. Using Stop Journey makes the execution flow stop after a desired condition has been met, thus helping in reducing execution time and getting faster responses.
For a better understanding of the working of Stop Journey, here's a small use case illustrated.
You have a shop where you sell some products. Based on the subject of the emails you receive, you want to perform specific actions.
- If you get a Product Update email, you want to store the contents of the email in a Google Doc for future reference.
- If you get a Product Issue email, you want to store the content of the email in a new row in a Google Sheet.
- If you get a Product Review email, you want to reply to the email.
To perform the desired action based on the subject of the email, you can design your journey to have conditional checks in the following manner.
When you receive a new email via Gmail.
Check whether its subject contains the keywords Product Update.
If yes, then append the body of the email to a specific Google Doc and then stop the journey.
If the subject does not contain the keywords Product Update, the next steps of the Journey will come into play.
Check if the subject of the email contains the keywords Product Issue.
If yes, then add the body of the email in a new row to a specific Google Sheet and then stop the journey.
If the subject does not contain the keywords Product Issue, the next steps of the Journey will come into play.
Check if the subject of the email contains the keywords Product Review.
If yes, then send an email via Gmail to the reviewer.
The entire journey’s structure shall look like this once the journey is ready:
In this way, you can create a journey with as many actions as you like.
Note: It is necessary to apply Stop Journey at the end of the last action in the first two if conditions. The top Journey action helps stop the execution process once the last action is present before it has been executed and thus avoids the unnecessary execution of steps present after it.
Once the desired condition has been met, there is no need for the system to check for the rest of the conditions present in the journey. Hence, the Stop Journey action ensures that the journey is stopped after the desired condition is met and its corresponding action is not executed. This prevents the system from unnecessarily checking all the other conditions present in the journey.
Thus, depending on your business requirement, you can include the Stop Journey action until your journey should execute the actions to avoid unnecessary execution and build an optimum and effective journey.