For Each Email Retry the currentEmail if currentEmail runs into an error

hello everyone,
im in need of idea on this one.

my RPA is like this;

  1. For Each Email (outlook)
  2. reads 5 unread emails
  3. add item to queue (the currentEmail’s details are put into queue item)

sometimes the currentEmail runs into error (sometimes due to bad internet connection), and im thinking of adding a retry scope
but i don’t know how to retry the currentEmail.

@JomarieBancolo

Just separate the bot logic into two bots.

Bot 1 dispatcher will add the mail message id to the queue along with other details if you want.
Bot 2 performer will get the email by id and process it. You can enable retry on queue level or simply add a retry scope.

Hi @JomarieBancolo

You are almost there

Please refer the below step and amend your workflow

For Each currentEmail in Get Outlook Mail Messages (Unread, Top 5)

Retry Scope Actions: Add Queue Item → use currentEmail details

Condition: Check True (or a small dummy activity)

Properties:

NumberOfRetries: 3 (or what you prefer)

RetryInterval: 00:00:05 (5 seconds)

Note : Retry will happen whenever an exception occurs. Otherwise, success.

Please let me know if it works

Hi @JomarieBancolo

You can try like below:

  1. surround your add queue item with try catch.

  2. now if due to some reason, current email details were not fetched, it will throw exception

  3. then in catch, you can try to fetch current email details again and add that queue item.

  4. please note that under catch, you may want to check the exception message. Note the exception message you are getting reading current email, and configure it accordingly as it can enter catch due to some other exception also. If you have unique reference enabled on your queue, duplicate queue item exception can also occur, so handling it accordingly will help here. if there is no such requirement, you can simply try to add queue item again in catch.

Hope this helps.