I'm running an unattended bot that interacts with a legacy ERP system. Occasionally, the ERP freezes, and the bot just sits there until the session times out. How do I build a "Self-Healing" workflow that can detect an application freeze, kill the process, and restart the transaction without manual intervention?
3 answers
Don't forget to use "Check Element" or "Element Exists" with a short timeout before every major click. This helps the bot realize the app has frozen much faster than waiting for a 30-second default timeout.
You need a robust Exception Handling strategy using "Try-Catch" blocks. Inside the "Catches" section, you should invoke a "Kill Process" activity for the ERP executable and then a "Start Process" to relaunch it. For a truly "Self-Healing" bot, implement a "Global Exception Handler" that counts the number of consecutive retries. If the app fails three times, have the bot send an alert via email or Slack with a screenshot of the error before moving to the next transaction. This ensures the bot doesn't get stuck in an infinite loop of crashing.
Are you using a State Machine for your workflow? It makes transitioning back to the "Initialization" state much easier when an error occurs compared to a standard Flowchart or Sequence.
Ronald is right. Using the Robotic Enterprise (RE) Framework is standard practice here. It has a built-in 'Init' state that handles application launching. If an error occurs during the 'Process' state, the framework automatically transitions back to 'Init' to restart the applications. This modularity is exactly what you need for legacy systems that are prone to crashing. It keeps the login logic separate from the data processing logic, making the whole system far more resilient.
Good point, Helen. Setting a "Ready State" to 'Complete' in the activity properties also helps ensure the page is fully loaded before the bot attempts to interact.