Retry scope - move file

Hi. I have a process that sends an email with an attachment and then moves the attachment into a “processed” folder. I have the move file activity in a Try Catch so I can catch any instances where the file is locked and cannot be moved. I can then use the exception value to notify the user at the end of the process that a number of files could not be moved.

I was wanting to use a Retry Scope and then retry the move process in case the lock is removed due to timing. I couldn’t figure out the condition part of the activity and how I could use it with the exception.

Not sure if there is a better way to do this or if I’m simply missing something.

Thanks

Craig…

In the Retry Scope activity, if you leave the Condition blank, it will retry when any error is encountered. This is almost always the way I use it.

There are also some activities that can be used in the Condition section, but not all activities. The most useful one I have found is Check True.

It seems like a good activity for what you are trying to do. You might still want to surround the Retry Scope with a Try Catch so you can still notify the user if the files could not be moved, even after the Retry Scope.

1 Like

Hey @craig.norton
You can try use a boolean variable that represents whether the operation was successful or not.
In Try Catch block inside the Retry Scope activity in Try section, attempt to move the file.
If successful, set isSuccessful to True.
In the Catch section set False.
You can use specific exception that occurs when a file is locked (e.g. IOException).
As condition you can use check true activity and put your boolean value.


Here is example workflow:
BlankProcess118 (2).zip (8.1 KB)

This topic was automatically closed 3 days after the last reply. New replies are no longer allowed.