Create system/business exception from an Invoked Workflow

Hi!

Can someone help me create a business/system exception inside an invoked workflow?
Once that exception is encountered, the bot will proceed to End Process (Reframework).

image

@caduque

are you looking for following?

  • creating a system exception: new Exception(“This will be the message text of exception”)
  • creating a bussines exception: New BusinessRuleException(“This will be the message text of exception”)

can be used e.g.:
grafik

Tried doing that but the bot would not go to End Process after encountering the exception in the Try Catch

have a check on the retry settings. The best technique to find out what is happening is to debug the flow

Please note that I am not using Orch here. Im just using reframework so I can master it.

When using ref, retry scope is/ can be set over the config file. However Debugging is the recommended technique to find out what is happening

@caduque If you’re Throw- ing a Business Exception in the Init State, According to the RE-Framework Transitions, it will only consider the SystemException Variable to Check if there is an Exception, Hence, the Business Exception Thrown is not recognised in the flow. However, then It is Catched and moved on to the Get Transaction State.

This can be verified if you do not have any Business Exception Error being Catched in your Init Try Catch Block.

But you would need to Debug the Workflow for better understanding if at all it is not the above situation.

I commented out the GetTransaction and Process State.

@caduque Can you show us Screenshots of the Init Catch Block and the Successful and SystemException Transitions ?

Here it is:

— My invoked process that I inserted in Init State


image

—The Catch block inside my Init State

image

—Transition from Init to End Process

@caduque If you have not performed a Debugging of the Process yet, Can you use a Message Box after the Assign in Init Catch Block with the value Exception.GetType and check what is the Value when the process is Executed, and also can you show us what is the Exception being raised in the Throw Activity ?

Can I just send the invoked workflow I created? Everything was untouched when I opened this Reframework.

Open_HRIS.xaml (12.6 KB)

@caduque As I have used your Workflow for Testing of the SystemException, the Catch block does Catch the exceptions, So I could not fully replicate your issue :sweat_smile: .

However you can Debug the Process, Either using the Debug Option or by placing Write Line/Message Box Activities at places where you think the process control is going to drive through.

The catch block would not work on my end. I tried using the wrong credential to feed on my invoked workflow, but the bot will still go to the next invoked workflow.

@caduque Then I believe there is no Exception being raised when you enter the Wrong Credentials, Since Element Exists Activity just Checks whether Element is Present or not, Which will result in a Boolean output if the Element isn’t present, It wouldn’t raise an Exception :sweat_smile:
Hence there is no Exception being thrown

After the Element Exists Activity is being used, You can check using an If Activity whether the Output of the Element Exists Activity is False, then throw the Exception Accordingly

Any suggestion on how I can solve that?

@caduque That would depend on what is the Element Exists Activity Checking on?
If it is Checking for the Logged In Screen, then you can do the below Steps after the Element Exists Activity.

  1. Use An if Activity with HomePage variable as the Condition.
  2. Keep then Block Empty
  3. In Else Block, Use Throw with SystemException

The Rest of the flow should handle that exception being thrown.

On the xaml file I’ve sent, the bot is checking if the HomePage exist. Note that the HomePage will only exist if you entered the correct credential.

@caduque Then Can you please follow the Steps that I have mentioned above then Check the Process Execution.
Please revert back if that didn’t Solve the issue and let us know what exactly has happened