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
anu_karthianu_karthi 

Regarding Cross object field updates

Hi everyone,

 

i have 2 objects for example Object A ,Object B.Now my requirement is in such a way , that object A & B are not related to each other....No masterdetail relationship is  there between A& B.But i want to write a trigger in such a way,that when the trigger (afer insert,after,update,before insert,before update)  on Object A fires then i want to update the fields in object B (For example updating a checkbox field in object B).....  

 

SO as iam new to triggers in salesfo.rce, please help me with an example code.....for doing cross field updation

 

Thanks&Regards,

Anu..

bob_buzzardbob_buzzard
If there is no relationship between the objects, how will you identify object B that needs to be updated when object A changes? 
anu_karthianu_karthi

hi bob,

 

 Thank u so much , i understood that i cant update fields of such objects...Thanks a lot for ur valuable suggestion .So if possible will you please send me an example on field updation between 2 objects  where dere is master detail relationship between 2 objects.... Please help me an example as iam just trying to learn triggers.....

SFDCRRSFDCRR

this might help

trigger Assignedupdate on Assigned__c ( before insert )
 {
CAS__c  c = Trigger.new[0];
Activity__c cas=[Select Id,CAS_Assigned__c from Activity__c where Id=:c.Request__c ];
cas.CAS__c = c.CAS_c;
      

update cas;    
}