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
Versus:
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.
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: -