We can have multiple automation processes created depending on their functionality, however, there is an interdependency across processes. For example, a user might have downloading of data from a website as the first step in the overall set of processes. The next process would be to validate and send the data to specified end systems. Then, the user might have the final process as sending a consolidated status email to the client. So, here is the design for the overall flow of the processes that requires the linking of the multiple individual processes.
In this entire flow, if the first process fails for some reason, e.g., if the website is not available, then we will wait for some time before retrying the same process. If we have a time-based trigger for the resulting processes, then it will fail as we have not yet downloaded data from the website as part of the first action in the process.
Hence, we need a way to trigger the execution for the following process once the first process has run successfully. This is where we can make use of the queue-based trigger.
Let us visualize what we are trying to accomplish here.
Process 1 is the main process that downloads data from the website.
Process 2 needs to be triggered once the data has been downloaded via Process 1.
Process 3 needs to be triggered after Process 2 has been completed successfully.
Let us see the steps toward accomplishing this.
1. Create the different queues that will be used as trigger for Process 2 and 3.
Create a simple queue for processes 2 and 3. You may want to set the Auto-retry to “Yes” based on your requirements (e.g., If you are using the RE Framework for your process and have the auto-retry for it already then you may want to set this to “No”)
So, for this example I have the two queues created on the UiPath Orchestrator.
2. Ensure that both process 2 and 3 are defined as queue-based triggers.
Process 2 executed based on the Process2Queue.
Similarly, process 3 is executed based on the Process3Queue.
3. Now simply add the following code in process 1 to populate the data into the process 2 queue. Ensure that you are adding the item to Process2Queue.
4. Similarly, have the “Add Queue Item” code to the process 2 to populate the data into the process 3 queue.
5. Now, you can test your code. As soon as process 1 completes, it will push the queue item to the process2 queue and process 2 will get triggered. Similarly, at the end of process two, the queue item will be pushed to process queue and process 3 will be triggered. You should be able to validate the same in the logs.
Thus, using this design you can easily chain the processes as needed. The main advantage of this design is that you do not need to take any manual action if there is any issue within any of the processes. It will be automatically handled using the queue-based trigger.
If there is a conditional logic within the chain e.g., trigger process x or y depending on the outcome for process one, then it can be easily done as well.
There might be a scenario where we want multiple processes to run after the first process has run. In this case, you can push the data into the respective queue and add a delay between the different Add queue Item calls. This will ensure that you can execute multiple child processes after the parent process has completed.
Once the child process execution is started, then the queue item status can be set as “In Progress” using the Get transaction Item activity call. Finally, once the process has successfully been completed, you can mark the queue item status as Successful using the Set transaction status activity. This will ensure that you use the queue item status effectively to manage your transaction.