Best Practices: Select Variables scope


Last chance I did not pass the UiPath certification test. I’m preparing it hard. Studying and practicing more.

One of the questions was to select the scope for some variables, according to best practices. I have looking for the best pracitces related to variables scope, but do not find it. Managing Variables

Could somebody give me a hand? I usually select as scope, the Do or Squence minimum to ensure that the automation run, avoiding to do the variable global. But I am not sure.


Hi @joseprzgonzalez
you have to choose the scope in appropriate sequence only

if you are use for each activity and using manual index variable )
then index variable scope must be inside the for each activity
so that only it could work properly ( ex incrementing the index variable)



Unlike arguments, variavles are available everywhere in a workflow file, they are only visible inside the container where they are defined, called scope.

Variables should be kept in the innermost scope to reduce the clutter in the Variables panel and to show only, in autocomplete, what is relevant at a particular point in the workflow.

If two variables with the same name exist, although we highly recommend against it, the one defined in the most inner scope has priority.

For more ideas on best practices in terms of workflow design

In terms of every design aspects

Hope this would help you

Cheers @joseprzgonzalez

Hello, Thank you. This is what I was looking for =)

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