Variable scope

hi
i created a boolean variable with workflow scope. i am using this variable in a for each loop within the workflow. after existing the loop the value becomes default. it is not retaining it’s value outside foreach loop. Can anybody explain why?

Thanks

Hi,

Can you share your workflow file?

Regards,

Hi @MadhuK,

Check the following:

  1. Double check the scope of the variable in question. If you have not renamed the sequences, you can easily get confused with the scope.
  2. Check for duplicate variables
  3. The default value of Boolean variable is False (Even though you explicitly don’t assign it)

Regards,
Nithin

Seems like you have created two variables with same name but in different scope. Select the body sequence of the each loop and then check variable panel. There should be two variables. Delete the one inside the for each scope.

1 Like

Thank you for the response. I defined my variable in sequence scope. No duplicates. Do i need to have my workflow in a flowchart for global scope?

Thank you for the response. But the variable names are unique.

Is it possible to send your workflow file? Also name of the variable that you are facing issue with.

Thank you. We resolved it.

What was the solution?