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

Master Detail Field Update - All Child Records

I have a Custom Object Called Services_Selection which is a Master/Detail to an Account.


When a certain field in Account is updated or changed (for instance a field called "Base Fee"), I want to update a field in all the related Services_Selection records.  


Since I am not aware on how to write this code I will explain it out:


When Account.BaseFee is changed/updated,


Set Services_Selection.Field1 = Services_Selection.Field2


Loop this until all child records are updated.  


If you have any questions, I will be glad to answer. Thanks in advance


Thank you,





trigger  UpdateChilds on Account (before update){

set<id> accids = new set<id>();

 for(Account ac :{

    if(ac.BaseFee != Trigger.oldmap().get(




Map<id,Account> accmap = new map<id, Account>([select id , (select field1, field 2 from Services_Selection) from   Account where id in :accids]);


List<Services_Selection> serList = new List<Services_Selection>();

for(Account ac:{




for(Services_Selection ss: serList)


  ss.field1 = ss.field2;


update serList;





the above is basic logic .  u need to modify it to suit u r needs and avoid any limits problems.


this is  my first post in the community. :)


Hi!  I was wondering if you could help me too :smileyhappy:, I have a similar question and I have VERY limited SF knowledge.


I have my opportunities set up so there is a header with custom products rolling up to the header.  I want the stage on the header to show "Closed or Open" based on the stage assigned at the product level.  For example, if I have 1 opportunity that has 5 custom products, I want the header to remain "Open" until all the custom products are "Closed" (either won or lost)


Thank you!