This article takes you through a process that can be a helpful way of versioning your task trees in the case that there are no updates to the inputs and outputs. If there are updates to the inputs and outputs, it is a different process and different matter. Sometimes, though, you just need to change the contents of your routine, but there might be in flight items already in the middle of that process that you need to "protect" so that they will successfully return from the routine to the calling tree/routine. You do want all new items, however, to follow the new process. This reviews one method for achieving that.
Here is an example routine:
This routine does a couple of lookups, then creates an incident for ops and then once ops is done their work, an incident for the NOC. Let's say that we need to add a lookup and use that new lookup to populate details in the incidents. If we add this lookup before the ops incident (where it belongs because the ops incident needs the info, too) and there are any in flight items when they try to create the NOC incident later there will be an error thrown because it will try to use unknown variables. But I can't delete the routine node from where it exists in the main tree and replace it with a new version or it won't return. Also, there may be many trees that call this one routine. I don't want to have to update them all because I need to make an update here. That defeats the purpose of a routine. I have all the inputs I need, and I'm not changing my outputs, so I shouldn't have to do that.
First, I'm going to create my version 2 routine, by cloning my version 1 routine and making my updates.
So I add my server lookup based on the request details, update the ops and noc incident details, and save that. My version 2 routine is now ready.
Then I go back into my V1 routine. I disconnect my start node from the existing workflow, leaving everything else about the existing workflow intact. Then I add the V2 routine and connect the start node to the V2 routine, passing the inputs from the V1 routine into the V2 routine. Then once the V2 routine returns, I also return that output from the V1 routine.
Once you need a V3, you do the same:
So you aren't continually adding depth or complexity.