Posted: 25 Oct 2016 15:49 EDT Last activity: 19 Jul 2018 15:44 EDT
What is the best practice for chaining multiple activities in a sequence?
It seems there are multiple approaches to triggering an activity from the completion of a prior activity. Using the completed event of activity1 to call actiivty2.start or simply calling activity2.start at the end of the activity1 automation. I was wondering if there is an advantage to using one method over another, or if there is a recommended best practice for this.
**Moderation Team has archived post**
This post has been archived for educational purposes. Contents and links will no longer be updated. If you have the same/similar question, please write a new post.
There are at least 3 ways to do this (probably more).
Start the new activity from the Completed event of the previous activity
Before completing the activity start the next activity if desired
Place all of the activities on the queue and then let each activity determine whether to run based on current state.
My preference is the first method. This promotes writing reusable code and your intent is clear for someone reading your code. An activity Started event should call an automation to perform the necessary work. This work automation can accept input parameters and return a result which means it is reusable - not requiring an activity to start it. The activity Started event would then store the result in a parameter of the activity. Next add a Completed event handler which uses the result parameter to decide what to do next.
To someone reading your code, the intent is obvious. Perform activity 1. When activity 1 is complete review the result and take the next step and so on.