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
Amit Singh.ax1042Amit Singh.ax1042 

How to create trigger to retrieve child's child record?

four object is there 


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)




write a before or after trigger on job


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

//retrieve the Schedule Task fields using






Buss(Certified Developer)