I'm working a scenario where the Address of a parent record once changed shall update the address field of the child records as well.

Initially i created a process to do so and it's working fine.

What i want is to leverage Flows to do the updation of child records. If i create a helper flow with a variable to hold the ID for the parent record. I'd then pass the ID from my process to the flow and shall be able to fetch the new address field through a lookup.

But i'm stuck with fetching the child record IDs. It's not apex so can't put a system.debug and i can't use screens to see debug messages, becuase in that case it won't be autolaunch flow and i wouldn't be able to pass the parent ID from my process.

I believe i'd need to loop through each ID once i have them and then update each record.

I had been googling it for a while but not sure how to move forward.

Using process builder solves this but i'm learning flows and understanding features like looping, updation, looups would really help in automating complex scenarios.

Best Regards, Sangram

1 Answer 1


Ok, here's how I would do this. You're good with passing the ID into the Flow to get what the address should be.

  • Make a Record Lookup pointing to your source record to get your desired Address values pulled into various variables.
  • From there, you need to get a sObject Collection of all of the records that you want to change. Create a Fast Lookup for this, searching your target object for all records where the Parent Record is equal to the parent ID variable you passed in at the beginning.
  • In the Fast Lookup, set your Variable to an SObject Collection Variable. You'll want to also set your Fields at the very bottom to any Address fields you wish to possibly change.
  • Now create a Loop. Your loop should set to loop through the SOBject Collection Variable you just created, and the Loop variable should be a new SObject Variable. This tells the Flow that it needs to start going through every record you captured in the Collection, and the SObject Variable states/holds which record is currently being used by the Loop.
  • From your Loop, point to a new Assignment element. In your Assignment element, you can set the SObject Variable's address fields to the various values you got from your initial Record Lookup. You can set all of the fields in one Assignment.
  • You've actually completed the loop now. Draw an arrow back from your Assignment element to the Loop element.
  • Now make a Fast Update, telling it to update the SObject Collection Variable that contained all your records. Draw an arrow from your Loop element to the Fast Update, telling it to run when all records have been run in the Loop.

The Fast Lookup gets all the records and data that needs to be changed, the Loop passes each record to a handler, the Assignment changes the values in the handler, then goes back to the Loop to get a new record. It will repeat this until it runs out of records, then runs a Fast Update to push everything back up to the system. Slick, eh?

  • Hi Mark, Could you pls elaborate more on the 2nd point, to how to reference the parent ID. Off the top of my head, i guess i'm creating a lookup for child record ids where clause equals to {!whatheheck.Parent__r.Id},
    – user477
    Mar 26, 2015 at 17:52
  • When you pass the ID of the parent record into the flow, you'll need to store it into a variable. When you're referencing it, you can just call the variable directly, without having to use any relationships. If you name your variable varParentID, you'll just have to reference varParentID, no Parent__r or anything like that. Mar 26, 2015 at 21:52
  • Mark, correct me if i'm wrong, but speaking of the collection variable which will hold the child record ids and i've only the parentID, so how shall i get those children using the parentid. I read the docs it's taking about some cross-object stuff for which i'm not able to get my head around. Thanks
    – user477
    Mar 27, 2015 at 4:46
  • I think i got your point Mark, you're refering something like this - salesforceweek.ly/2015/02/…. Lets see if it works :)
    – user477
    Mar 27, 2015 at 8:57
  • It worked mark, i replace two processes with one process and one flow. Basically i can reach upto the grandchildren using the flow. Thanks a ton!! Regards,
    – user477
    Mar 27, 2015 at 10:32

You must log in to answer this question.