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
armsjmacarmsjmac 

flow not updating all records

Hi - I have created a flow which is meant to loop through all child records and update a couple of fields. The flow is getting the records correctly, assigning the new field values but on the last record that is updated it isnt adding it to the collection to be updated. Super weird and Ive pasted some of the code below as well as relevant screenshots.
From what I can see in this example:
1. All 5 child records are obtained without a problem
2. The loop goes through each of the records
3. The final record gets new values assigned but it doesnt get included on the update records which happens after the last record (in this case this is the record ending with XUAQ)

any help greatly appreciated

Final part of the flow and the record in question
User-added image
User-added image

2nd image shows only 4 records getting updated
User-added image
 
ShirishaShirisha (Salesforce Developers) 
Hi,

Greetings!

I would suggest you to capture the debug logs while running the flow to see,if there is any other criteria which is not meeting due to which the record update was not committed.

Reference:https://help.salesforce.com/articleView?id=code_add_users_debug_log.htm&type=5

Please mark it as best answer if it helps you to fix the issue.

Thank you!

Regards,
Shirisha Pathuri
Niks DeveloperNiks Developer
Hi armsjmac,

We can not directly update the records fetched from the Get Records element. Create another Resource of type Variable and Data Type of type Record, mark Allow multiple values (collection) to true, to make it a list variable.

When you loop through the records returned from Get Records, update the values for each record, and then add that record in the list variable.

Finally, perform Update Records on the list Variable.

You can check this link for detailed implementation: Record Triggered Flow with Example (https://niksdeveloper.com/salesforce/salesforce-record-triggered-flow-with-example/)

Please mark this as the best answer if this solves your problem. Thank you!

 
Kristian TorresKristian Torres
Hi all, 

I am having this exact same issue with a flow that's meant to query a list of related 'Asset' records when an account record is changed and update those asset records. Per Niks' suggestion, I created a separate asset record collection variable - 'assetsToUpdate'. However, when testing in the debugger, while it does show that the flow functions properly, when running the flow in production, none of the expected asset records get updated. Has anyone else been experiencing this since the Summer '21 update?
itfyjuhg hgfjhnfgitfyjuhg hgfjhnfg
Yes its the same issue that I am facing with the flow if someone has any idea about its solution please guide us you can see here (https://smokermasters.com/) the details of my flow issue.
JPSeaburyJPSeabury
Thank you, @Niks Developer -- your reply solved the issue I was running into! I owe you a beer!