function readOnly(count){ }
Starting November 20, the site will be set to read-only. On December 4, 2023,
forum discussions will move to the Trailblazer Community.
+ Start a Discussion
Alan BirchenoughAlan Birchenough 

Visual Flow Loop element isn't looping

I raised case #11639080 to ask for an explanation why a Loop in my flow - actually I have tested the same thing in several flows now - is not iterating over an sObject collection, and it has been confirmed that the behavior I am seeing has no obvious explanation.  However, they were unable to help me further since developer support is not included in Basic Support.

I have a flow that performs a Fast Lookup and sets an sObject collection called "licenseParts".  It then flows to a Loop that iterates over licenseParts, setting loop variable "part" on each iteration.  Unfortunately, though, it doesn't.  Instead, the Loop sets "part" to the first object in the collection multiple times - as many times as the collection size - but never assigns any of the other objects to this variable.  E.g., If the collection size is 9, it sets "part" to the first object 9 times, but never assigns any of the other 8 objects to the loop variable.  The loop is therefore useless for the purpose of processing each object in the collection.

I can confirm that the setup and usage of the Loop element matches exactly the setup and usage in the Loop example in Help.

Any suggestion on why the Loop is behaving this way?  Or is this just a flow engine defect?  Thanks for any insight.
Best Answer chosen by Alan Birchenough
Alan BirchenoughAlan Birchenough
Folks -

I managed to discover the answer to this for myself with the help of some colleagues.  The answer is: Don't use Textbox fields to debug your variables.  They are input field types and will overwrite the variable values.

Output text, however, would be perfectly safe.  Ironically, the more I debugged my flow, the worse it behaved!  LOL.