+ Start a Discussion
Andrew Williams 72Andrew Williams 72 

Flow - Loop - sobject "The flow failed to access the value for xxx because it hasn't been set or assigned."

I have an issue where my loop isnt populating the sobject from the sobject_collection on the Flow Builder (none Java version)

I have tried to prove the issue by using an Assignment 

User-added image

The Loop:
User-added image

then trying to pass this Loop object along:
User-added image

I get an email with all the correct info in the sobject_collection etc just this error on assignment:


 

Error element Populate_Line_Items (FlowAssignment).
The flow failed to access the value for VarOppo_Line_Item_Loop.acu_prid_id__c because it hasn't been set or assigned.

An ideas?

Best Answer chosen by Andrew Williams 72
Andrew Williams 72Andrew Williams 72
Hi David, thanks for the help. yes in desperation I unlinked the loopback.

I have solved this by using a subflow - it seems to get the object info just fine from there but not in the main flow.

The Main Flow
User-added image

The Sub Flow
User-added image

Best Regards
Andrew

All Answers

David PoynterDavid Poynter
Well first off your loop "for each item" path isnt connected back to the loop node, so it won't actually loop through the collection as it is right now.

With regards to the error, I don't believe that assignment is even necessary (if I understand your use case properly). If I understand you correctly, your are trying to assign the loop variable with the currently itterated object. However that is done automatically by definition by selecting that object as the loop variable.
At the current location of the assignment node, the "VarOppo_Line_Items" object is already assigned as the first object in the collection.

A seperate issue is that you are trying to assign "VarOppo_Line_Item" which isn't your temp object... you assigned your temp object as "VarOppo_Line_Items" (with an s), so that is another reason it isn't working.

My sugestion is removing the S from the temp variable and removing the assignment node (it shouldn't be necessary). As long as you are recording the values you want in the object when looking up the collection, you should be good to go without an assignment!

Hope this helps!
David PoynterDavid Poynter
Oh I am sorry... I read that wrong! 

Still need the loop to be connected to it actually iterates through the whole collection, but my only idea regarding the error thrown is that upon first looking up all the objects, you were not selecting "acu_prid_id__c" as a field to be stored. That is my only guess. :/
Andrew Williams 72Andrew Williams 72
Hi David, thanks for the help. yes in desperation I unlinked the loopback.

I have solved this by using a subflow - it seems to get the object info just fine from there but not in the main flow.

The Main Flow
User-added image

The Sub Flow
User-added image

Best Regards
Andrew
This was selected as the best answer