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
Lukasz PiziakLukasz Piziak 

Updating child record fields

Hi, we are looking for solution of the following scenario:
 
On  master record 'CMS - Certificates' we have checkbox field called 'CEM Created' which is manually selected.
On a child record 'CMS - Certificate Line' we have 2 checkboxes:
1. 'CMS - Ready' - manually selected
2. 'CEM Sel'
 
We woudl like to find a way that when 'CEM Created' on a master record and 'CMS - Ready' on a child record are selected system should automaticaly select 'CEM Sel' checkbox ona child record.
 
Will you have some idea what I can use to make this working? Flow, WR or PB?
 
Many thanks for help
 
Regards,
Lukasz
CharuDuttCharuDutt
Hii Lucaz
Try Below Trigger
trigger testTriggeron CMS_Certificates__c(after Insert,afterupdate){
Set<String>CMSCertificatesId = new Set<String>();
if(trigger.IsAfter ){
if(trigger.IsInsert){
for(CMS_Certificates__c cc : trigger.new){
if(cc.'CEM_Created__c == true){
CMSCertificatesId .add(cc.id);
}
}
}
if(trigger.IsUpdate){
for(CMS_Certificates__c cc : trigger.new){
if(cc.CEM_Created__c == true && cc.CEM_Created__c != trigger.oldMap.get(cc.Id).CEM_Created__c){
CMSCertificatesId .add(cc.id);
}
}
}
}
list<CMS_Certificate_Line__c> lstCCl = [Select Id,CMS__Ready__c,CEM_Sel__c,CMS_Certificate_Line__c from CMS_Certificate_Line__c where CMS__Ready__c = true AND CMS_Certificate_Line__c IN : CMSCertificatesId ];
for(CMS_Certificate_Line__c ccl : lstCCl ){
ccl.CEM_Sel__c = true;
}
if(lstCCl.size()>0 ){
update lstCCl;}
}
Please Mark It As Best Answer If It Helps
Thank You!