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
Monishan MMonishan M 

To update Master records based on value in detail record

Hi ,

I need to update a field in Master object based on values in field in Detail object.

When an email(master object) is sent , and actioned then a corresponding Email action (detail object) will be created for the master record.

Now based on a value in the detail record I need to update a field in the master record every time.

Can this be done via workflow or Process builder?
Can you please suggest the best way and how this can be achieved

Thanks

 
AbhishekAbhishek (Salesforce Developers) 
Use 2 Rollup Summary fields -- 1 to COUNT all the child records.  1 to COUNT the 'checked' child records.  Then, you can use a Workflow Rule Field Update that when the 2 Rollups are the same value.

===============================


Create 2 Rollup Summary fields on the Master Object
1 Rollup Summary field will rollup the Count of active child records
2 Rollup Summary field will rollup the Count of active child records where the checkbox is checked to True

Now create a workflow rule on the Master Object
Evaluation Criteria: Created and every time its edited (2nd Option)
Rule Criteria: Criteria are met
Criteria: Rollup Field 1 greater than 0
Immediate Action: Field Update
Update your field accordingly
Save and Activate the workflow rule


Let me know if it helps you and close your query by marking it as solved so that it can help others in the future.

Thanks.