Thanks for responding, For my case below Exit-Activity will not satisfy the requirement.
However when I use pega.terminateActivity() it still shows the same exception as with Activity-End Method. My requirement is like below:
From a flow utility I call Activity A which calls Activity B which calls Activity C. Now in C I am doing some validations and when a condition fails, all the remaining process in B and A should stop and the control needs to be handed back to the calling Utility Activity.
Thanks for the clarification. I believe you can use a flag parameter in this case and use this parameter in this activity. For example, if inside activity C some validation fails then you can set this flag to false and use Exit-Activity. I believe this should work out for you. Please let us know if we misunderstood something. BTW, what is the error you are getting in case you use terminateActivity().
Thanks for the response. Lets Say In Activity B there are 10 lines of code (each one is a when rule validation). Activity C is called out at every step to add some values to a page list. Now when the length of page list is greater than 1 I need to exit out of all the remaining code and send the WO to a workbasket. If I were to use the method as suggested above, I have to check for the condition in the Jumpstep for every step in the activity. Hope this is clear.
When I use terminate.Activity(), I see UniqueActivityTerminateExceptions which is the same as when I use Activity-End method.
Also when I create some empty activities with 2 or 3 steps like setting a few parameters and use Activity-End method it seems to be working fine, but when I use that in the original code I see the exception. Is it the general behavior of the method?