I’m working on the tutorial "Get started with RPA Development: Video demo - Build your first process part 1
I’ve built my first automation. When I try to run it I get “Save Last Task Mail Attachment: Index was out of range. Must be non-negative and less than the size of the collection. (Parameter ‘index’)”
Has anyone done this tutorial and could offer a clue to me? Thank you
You might be using variable(1) in save attachment activity and there is no attachment for that mail.
You can use if activity before that with following condition. Item.Attachments.Any
Where Item means your mail variable. This checks if there is any attachment. You can use save attachment in the the part of the If activity.
The error message “Index was out of range” usually occurs when you are trying to access an element in a collection using an index that is either negative or greater than the size of the collection.
In your case, the error is occurring in the “Save Last Task Mail Attachment” activity, which suggests that there may be an issue with the email message or attachment that the activity is trying to save.
Here are some troubleshooting steps that you can try to resolve the issue:
Check the configuration of the “Save Last Task Mail Attachment” activity. Make sure that the properties such as “Attachment Index” and “File Name” are set correctly. Double-check that the attachment exists and can be accessed by the activity.
Check the email message and attachments. Make sure that the email message contains at least one attachment and that the attachment is in a supported format. Check that the attachment can be accessed and saved manually.
Try running the automation again with a different email message or attachment. If the error persists, try running the activity with different configuration options such as changing the attachment index or file name.
Check the logs for more information about the error. The logs may provide more details about the cause of the error and help you identify the root cause.