0

BACKGROUND I have two objects in a master-detail relationship. One is Parent, the other is Child. I have a Process Builder Flow that starts when a Parent record is created or edited. I have criteria on the Process Builder Flow that when the field 'Review Date' is changed on the Parent, it has an immediate action of a Flow called 'Change Review'.

THE PROBLEM One of the Set Flow Variables I need to pass to Change Review Flow is the Id of the Children. However, I cannot access the ChildIds either as a Field Reference or in a Formula. Process Builder will not let me save when I use the formula [Parent__c].Child__r, saying that the field doesn't exist, even though it is available if I try to add an Action Type 'Update Records'.

THE QUESTION How do I pass the ChildId from the Process Builder Flow to the Flow?

0

Think about it.... If you have a Master-Detail between the parent and the child objects, that means you have a 1-to-many between the parent and child where each parent can have multiple child records. Whenever a parent record is created, you don't even have any child record(s) yet, so you may not want to trigger your process during parent's creation. If you set your process to trigger whenever your parent is edited, and knowing you have a 1-to-many between parent and child, how does Salesforce know what child's id to pass to the process when you can have multiples or none? Even if you have just one child record, Salesforce still sees it as a 1-to-many relationship. That's DB principles.

Are you trying to update one or all child records? If it's just one, you may want to start your process from the child object... if it's all of them, process builder should be able to do it using the Child__r 'field'.

For more information on how to update child records from a parent, please look here:

https://help.salesforce.com/articleView?id=000213419&type=1

0

The architecture to follow is to:

  • Pass the parent record's ID to the Flow
  • Have the flow query the children records based on the parent ID
  • Iterate through the results and do what needs to be done on each child

If the PB is invoked on Parent create, there will be no children and the Flow will find no records to operate on and just loop through an empty collection

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.