Use Local Trigger With Unattended Process

I’m not seeing many others ask questions on this, and perhaps it’s because I’m the first person to try.

I am building an unattended foreground bot using a modified REFramework model. The application that I am automating is old and unstable, and will often crash unexpectedly. When it does so, it is typically very good at presenting a popup message with the crash details. A lot of these crashes are outside of my control, and the only solution is to close the app entirely and restart it.

This sounds to me like an excellent use for a Trigger, specifically the Activities - Application Event Trigger (uipath.com). I should be able to set up this trigger inside of a trigger scope and have it watch for the popup to appear. I am recording this popup with the Object Repository and have the Event Type set to “Appeared”. I have set this up in a workflow I’m going to call a Responder (stealing the name from MediatR) to avoid confusion in the future.

The problem comes when I try to use this trigger within my app. Using an Invoke Workflow activity to invoke this responder allows it to enter the trigger scope, but then it blocks waiting for the trigger. Using a Run Local Triggers activity also blocks. This means my app never runs because it’s waiting on an event will never fire.

In small scale tests, using a parallel activity and invoking the Responder next to my State Machine seems to work, if unreliably. This method seems to introduce a lot of unexpected behavior and instability into my application.

My desired setup would be to treat this something like the UiPath Forms feature, where the main application is able to run while the Local Triggers wait for their predefined event. I want the State Machine to operate as it would, being interrupted in the case of a Local Trigger execution and allowing the trigger to complete before continuing.

What is the recommended way, if any, to integrate Local Triggers with Unattended Processes in a seamless manner?

1 Like

@Foxtrek_64

Did you try using global exception handler?

As in scenarios like this it would help where you can check in geh that if the crash pop up has come then perform so and so steps else continue with normal flow

Cheers

I have looked at this in the past. Being able to return to return a status of ignore/retry is convenient. That said, the global exception handler is only triggered after an unmanaged exception is thrown, so it’s too late to actually be looking for these to handle preemtively. I will likely have one regardless just to help with error cleanup should the bot encounter an exception, but I want the bot to be actively watching for these rather than just waiting on an exception to be thrown.

@Foxtrek_64

Then you can use a prallel activity with handling that pop up on left side in a loop and actual process on the right

Cheers