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

How to create trigger to retrieve child's child record?
four object is there
1)job
2)job task
(master detail relationship between Job(master) and job task(Detail))
3)Schedule Template
4)Schedule Task
(master detail relationship between Schedule Template(master) and Schedule task(Detail))
all fields on job task and schedule tasks are same(except relational part)
one more thing is, there is lookup relationship between job(detail) and schedule template(master)...I want that when I select any schedule template on any job page then all the schedule task related to that particular schedule template should be copied into Job tAsk.(How to make trigger on job)
Hi,
write a before or after trigger on job
for(job__c newJob:trigger.new){
newJob = [select id,name,(select id,name From Schedule Templates) From Job__c];
//now you got one level child (Schedule Template)
//to access Schedule Template filds follow newJob.Schedule Templates.fiedlname (object plural name)
//next level
for(Schedule Template schtemp: newJob.Schedule Templates){
//query child-childs fields here thrgh schtemp.id
//retrieve the Schedule Task fields using schtemp.id
}
}
Reds,
Buss(Certified Developer)