Setting the workitem status to failed if an error occurs
Is it possible to force a workitem to fail in AA360? For example, i have a queue set up that needs to log into a website and perform some tasks, sometimes the bot struggles finding a link on the website and throws and error. I can set the workitem result to “Error - description” but the status of the work item remains complete:
is there a way we can set this in the bot to a failure and it can be retried?
Thanks
Tom
Page 1 / 1
Hello, I am replying because I have this same question. We are running tests inside of Try/Catch blocks. None of our tests show a “Failure” due to the Catch block handling the errors even if the tests did actually fail. I would like to know if we can force fail the script within the Catch or Finally blocks so that we can show test run reporting in the History and Bot Insights sections in Automation Anywhere.
Best practice is to utilize Try/Catch but right now we wont get a Failure if the Catch block handles the error successfully. We definitely still want to see Failures when the Catch block is invoked so that we can investigate and fix the issue faster and have better reporting metrics.
One other thing I noticed is using the Try/Catch blocks actually make using a cleanup script easier as you know which applications/browsers may be open for a currently running script and you can close them specifically if the test fails. However, if you do not use the cleanup script at the end of the test(In a finally block) then you subsequently have to make a cleanup script at the beginning of each script that will run to try and close any open Browsers/Applications without you knowing what might actually be displayed. There is a lot more ambiguity when running a cleanup script at the beginning of each task bot to be executed.
Thanks, Ben
@Tom 2382 There is no directway to do this but using api we can achieve
To update the work item from the queue, we need to follow the Request body syntax shown below.
Just throw error explicitly from your master bot and it would mark as failed.
Even if you are using try catch, check in catch: This error is unhandled/should fail in queue? Throw error
Hi.
When doing the API call I get: "message": "Work item cannot be set to given state from existing state"
Trying to update the status from NEW to ACTIVE
Any ideas?
I’ve tried to execute the update work item using API, but I get next error “Invalid work item id” (image2 and image3), but using the ‘Get work item by ID” works fine (image1). What will be the wrong? Thanks for your help
I’have the same problem when i try to execute the update work item using API. I get error “Invalid work item id”. Thanks for your help
Did anyone figure out how to do this from the Try/Catch/Throw? I want to easily reprocess failed items from the queue screen, but don’t want to have to reload them or force an update using the API. Thanks.