I am unable to end the process and get the next transaction item if it hits a business exceptions. In my process.xaml, i have a flowchart where it invokes the following workfile sequences:
- checks account by searching account number
- updates account payment info
- updates other things
In the first workflow:
I have a try catch, where i put below in the Try section:
if there is no account in my application associated with that account number it throws an error: new BusinessRuleException(“no account”)
In the catch section:
i created a business rule exception called exception, and then it invokes an exception workflow that creates a ticket in the system to notify admins that the account is not present. Then i added a rethrow. I thought the rethrow would send the business exception to the main of the reframework, in which it should stop the process for this item and get the next item. However, instead of get the next item, it continues the flow. It goes though the exception workflow and then goes to 2. updates account payment info
How do i stop it from processing, and get the next item to process?
Instead of using a try catch for this, try using the below order.
You already have a way to check whether there is a account associated with the account number. Use this check to generate a boolean result.
Use this boolean in an IF/ flow decision activity which allows you to create two paths depending on the value you get for the boolean. Let’s say the boolean value true means it does have an account and false means it doesn’t…
If True (has a account), the flow should continue as normal. So place the required activity in the relevant section of the IF condition. If it is false (which means it doesn’t have an account), use the remaining side of the if condition to place your business rule related activities here.
In that section, before adding the throw activity to throw the business rule exception, invoke the code that is required to create the ticket. After all those things are done, then add the Throw activity that throws the business rule exception.
This flow will do the required task as expected.
To summarize, using the condition, check whether the account is available or not. Depending on the result you get, use a IF/ Flow decision condition and divide the flow into two sections. If account is there, use the if condition to go through the normal flow. If not, again use the remaining side of the if condition to create the ticket and then throw the business rule
I would recommend to use a flowchart except of the sequence to handle this.
This will work for you