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
HelloSanHelloSan 

i need a apex trigger code to fetch child records Opportunities for each record Year(Custom Object) and i need to process those child records in loop

eg for Year 2015 i have four Opportunitites i need to fetch those four opportunites based on parent id
for(Year__c y: ylist)
{
for(Opportunities opp : y.Opportunities)
{

}
ManojjenaManojjena
Hi San,

Can you please elaborate your requirment .
Sagarika RoutSagarika Rout
Hi , 

Query those opportunities based on Parent Id.After getting the records, iterate in a loop .

for(Year__c y: [Select ID,[Select Name From Opportunityes] From Year__c]){
    for(Opportunityes opp : y.Opportunities){
            system.debug('Opportunity Name---->'+opp.Name);
       } 
}

Hope this will helpfull !!!!

Thanks,
Sagarika