I have a rather large process with a loop. The process performs the following steps (very high overview):
- Navigate to URL.
- Determine the loading page.
- If a login form exists, log in and load report. Otherwise, load report.
- Read Excel file.
- For each row, set parameters and download report.
While the workflow is downloading reports for each state, it may run into an issue where the report parameters section does not load. In this scenario, how would I program the workflow to automatically stop? Would kill process work for this instance?
Hello @BrandonTerry you do not need any activity to stop workflow, you only need to end the flow by disconnecting the next activities. Find below example.
If report parameter not loaded, It will print something and bot will stop as there are no further activity after consoleLog
What if the process I want to stop is in a subprogram? For example, let’s say I have the main.neek two subprograms connected: sub_A and sub_B. If sub_A runs into an error, I can do as you say and just leave its last activity disconnected, but then sub_B will be executed anyways. Is there a way to actually stop the process before the execution sub_B?
If you add your subprogram sub_B in your subprogram sub_A. For example if you invoke sub_A in main.neek file and sub_B in sub_A file but not in main.neek, you can achieve what you want.
Note: Answering you what I understood by your scenario. If it does not meet your requirements you can share your wider view of the project and we can come up with a solid solution.
I hope it solves your problem. Waiting for your feedback! Have a nice day
Muhammad Hayyan Khan
Hmm I see. Well, my situation is different. I have both sub_A and sub_B being invoked in the main.neek file. So sub_A is executed first, then sub_B. So if something goes wrong in sub_A but the process goes on without interruption, sub_B will be executed. I’d like to stop sub_B if something goes wrong in sub_A. If I understood your explanation correctly, the only way I can achieve that is if I invoke sub_B inside sub_A.
If you are able to change your flow. Then this is the best possible solution. Other than that if you can share your flowchart, we can come up with other best possible solution as well.
Hi @cris-dsc, We’d like to follow up on this. Please let us know if the solutions we provided above worked for you.
I have found a way to deal with this. A colleague suggested using a variable as a verifier. If something goes wrong in sub_A, i set its value to 0, if everything goes smoothly, I set its value to 1. This verifier is then imported from sub_A to the main.neek file. If verifier = 0, then it’s connected to nothing and the execution is interrupted; if verifier = 1, then it’s connected to sub_B and it is executed normally. It’s a bit complicated and requires decision-making from the robot, but it’s useful for many other parts of the entire process and doesn’t require a subprogram to be specifically invoked inside another subprogram.
Hi @cris-dsc, We appreciate you sharing your thoughts and the steps you took to implement the solution.
This is how I had to handle my process as well since adding subprograms to my workflows; however, it would be great to have some activity that ends a process at any given point. I’ve added it to the idea board.
@BrandonTerry excellent that you have posted the idea to board as well.