You need to sign in to do that
Don't have an account?

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 : Trigger.new){
if(ac.BaseFee != Trigger.oldmap().get(ac.id).BaseFee)
accids.add(ac.id);
}
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: Trigger.new){
serList.addall(ac.Services_Selections);
}
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!