You need to sign in to do that
Don't have an account?
Tanvi Kakkar
trigger for field update on unrelated objects
I have two objects parent__c and Teacher__c . There is no relationship between them .no materdetail no lookup .
Parent fields: name(text )
, email (email)
, teacher_expertise (text)
Teacher Name (text)
Teacher fields :
- name (text)
expertise (picklist)
I would like to update teacher field on parent objects :
Please help . Urgent
Thanks
Parent fields: name(text )
, email (email)
, teacher_expertise (text)
Teacher Name (text)
Teacher fields :
- name (text)
expertise (picklist)
I would like to update teacher field on parent objects :
Please help . Urgent
Thanks
Hi Tanvi,
Write a trigger on Teacher object and in trigger check the parent record which matches with Teacher record based on the field which you are matching and then update the Parent record. Code will be something like this:
List<Teacher__c> t=trigger.new;
List<Parent__c> p=[Select Name,Teacher_expertise__c from Teacher where Teacher_expertise__c IN : t.expertise ];
List<Parent__c> pt=new List<Parent__c>();
for(Teacher__c tc:t){
for(Parent__c par:p){
if(par.Teacher_expertise__c ==tc.expertise ){
tc.Name==par.Name;
}
}
update p;
}
Change the fields according to you.
Please mark this as Best Answer if it helps you.