Best practice for executing a subset of Workflow steps

Hi there!

We have a use case where we sometimes need to begin a workflow from a later activity. For example in the workflow that consists of Activity1 > Activity2 > Activity 3 > Activity 4, we might need to kickoff the workflow from Activity 2 (and then continue the rest of the sequence). What’s the recommended approach here?

  1. Create a second workflow that consists of only Activity2 > Activity 3 > Activity 4?
  2. Pass a value into the workflow that indicates which activity to start from?

It is your design decision. Both approaches are easily implementable with Temporal.

  1. For this approach, you can create a function that implements “Activity2 > Activity 3 > Activity 4?” sequence. And then, both workflow types can use that function to avoid code duplication.

  2. For this approach, you can use the standard if-else logic of your programming language.

1 Like

Great, thank you!