Return Statement Activity for XAML files

In order to make things more comprehensible, I propose a new activity that allows for a xaml file to exit out of itself in the middle, much like a return statement in a function. Not only would this be helpful in testing, where there are portions that must be tested without continuing on to other tasks that have already been placed in the xaml file below the portion that requires attention, but it would also be helpful in order to make files more readable.

I currently have a case where I want to send out an email if I have processed at least one transaction. Instead of wrapping that entire section in an if statement, it would be nice to create an if statement that could return out of the xaml file so that the rest of the code could be unwrapped below since we can be sure that it will only continue if it is the case that it should.

It’s the difference between:

If TransactionNumber > 1 Then
    Get email information
    Create email message
    Send email
End If


If TransactionNumber = 1 Then
    Return out of current xaml file
End If

Get email information
Create email message
Send email

I was just looking for a “non-existing” Return activity, because I had a use case for this.

The use case was:
Searching for an invoice and updating some fields in a system. If the invoice could not be found then I wanted to return back with no exceptions thrown. As a workaround, I will need to make the code more difficult to read by adding an outer IF scope.



Thank you for your suggestion. I added it to our internal ideas tracker for our team to consider.

1 Like

Any updates to implement Return functionality/feature from XAML files without throwing an exception?

Hi @rprasanna,
Currently, this feature is being under review as a potential feature for one of the next year’s releses.


we are using Exceptions as a work-around for the missing return-Activity. Will the return activity be in the next relase as promissed in Oct. 21?

If the Throw-Exception-Activity had a flag “Do not Log an Error” it would fit our needs as well. But this would probably be an other issue.

Thx Stephan

Adding my voice to this chorus. I’m finding a need for this in a Library member that logs on to the Acme website (I’m a UiPath newcomer following the Orchestration tuition module). It would be nice to use Return in place of the Throw, below: -