Getting problem in Exception Handling

I am working on purchase order automation. So, I am reading data from excel and entering the data into Netsuite the issue I want to put an exception if I enter the wrong entry in the NetSuite and it will stop that entry and move forward to the next entry.

I am unable to do that any solution for that?

1 Like

Hi @praveen_sonkusare

After entering the purchase order, use element exists activity (variable name boolresult) and Indicate the wrong purchase order message and after that use an if activity and give condition as not boolresult,in the then part do your process and in else it will skip the process.

or put an try catch inside for each row and catch any exception and continue with the next iteration

Thanks

1 Like

I tried try-catch block but after the first exception, it got stopped not going forward.

You have to put the try catch in the body of the for each row, could you show shome screenshots of the workflow…

Thanks

Main.xaml (110.8 KB)


Hi @praveen_sonkusare

Apologies for late reply, can you remove terminate workflow and try, because of that the workflow stopped after first transaction.

Thanks

1 Like

Hi

You are using terminate workflow
That’s the reason the bot is stopping

May be I will tell in detail how try catch works

Now you are placing the activity inside the TRY block of TRY CATCH activity

If that activity fails entering value then it will be caught by CATCH BLOCK and the bot will now try to execute the activities in CATCH block

And there you can use a LOG MESSAGE activity to trace that exception

And after that leave it and don’tu use TERMINATE WORKFLOW

That activity will terminate the bot running further

And if you remove that activity bot when exception occurs it will catch block and continue executing with next transaction

That’s how try catch block works

For more details on how try catch works

Cheers @praveen_sonkusare

1 Like

I removed the terminate workflow but it is still not working

Hi

Please ensure that you are running normal mode and not in debug mode

Click on drop down in that play button and click on RUN

If we directly in play button that appears in design tab it starts in debug mode

And if the process is running debug mode try catch won’t catch the exception and it will stop if any exception comes

Cheers @praveen_sonkusare

1 Like

OK I will try and back to you

1 Like


please check that excel sheet first I am reading data from the excel sheet.

  1. first entry is successfully saved in Netsuite.
  2. while entering the second entry it gives me the popup No match you can check the snapshot.
  3. So, what I need here is it stops here and writes a log message that PO is not generated and goes forward for the next entry.
    Any solution for that because i tried lot but not getting any solution

Hi, Guys any solution regarding my problem.

Thanks
praveen

Could you help me please…

Thanks
praveen

You don’t specifically need try catch solutions for this, although they are usefull.
If your exception comes at a predictable point in your process you can use things like find element or element exists to detect if a specific error popup occurs. If no, just continue. If yes log your message, cleare the popup and continue.

Try catch can do the same, but is better for more… unexpected or complicated errors.
As stated in previous posts: your try block is your set of regular steps if all goes well. Your catch block are the steps that you undertake if it goes wrong. In your case the activities to log the exception. What I suspect, based on your description, is that you do not reset your UI for the next transaction. (Clicking the popup, making sure you can continue with the next order line)

But using try catch or element exists it comes down to 1) detecting your error, 2) handling the error and 3) making sure your UI is set for the next steps again.