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
TROGTROG 

sObject Changes Not Saved Within a Visual Flow Loop

VISUAL FLOW.  My scenario.  I fast lookup and load records into collection sObject called..."Objects".  I then loop through "Objects" using loop variable called "Object" and update some of the values for each of the records within "Objects".  When that loop is done, I loop through "Objects" again a second time (using loop variable again called "Object") and SOME of the values I updated in the first loop arent there in the second loop.  Ie. I'm making changes and immediately looping again and the changes aren't there.  It HAS to be a defect, but as SFDC doesn't support FLOW my understanding is that (like other issues I've run across) the only option is work-around.  Has anyone else come across this?  Any recommended work-arounds or better clarity on what the specific issue is to help me work out a good alternative?
UC InnovationUC Innovation
Hi TROG,

Are you commiting those changes via a 'Record Update' or 'Fast Update' Call? You might need to do another lookup call to retrieve the newest version of those records after the first update as a workaround. This is inpractical. Other than this, you can try to restructure the logic/sequence such that you only do one update at the very end of the flow process.

Hope this helps!

AM
TROGTROG
Thanks for the response.  For performance reasons, I'm not fast-updating and then re-loading via fast lookup to commit an intermediate change.  What I'm fearing/assuming is that you can't do multiple loops to continually massage data within the same sObject collection.  I fear that you need to loop thru your collection1 and then add the modified record to a new sObject collection2....then loop thru that collection2, modify, and add the modified records to a new collection3, etc.  I agree w/ your suggestion though - as a workaround (if I understand the issue/limitation correctly), I'll need to re-arch and change the order of my FLOW.

Knowing is half the battle.  Go Joe!
UC InnovationUC Innovation
You can also simply add the element from list 1 to another sobject collection list 2 after every itteration of your first loop. This makes for minimal changes to your current logic. Since you are essentialy dealing with a copy of the record with every pass of the loop.

Hope this helps!

AM