You need to sign in to do that
Don't have an account?
raju p 4
rollupsummsry isuse
trigger Agregate on Student__c(after insert,after Delete,after undelete) {
list<id> ids= new list<id>();
if(trigger.isinsert || trigger.isUndelete){
for(Student__c s:trigger.new){
}
}
if(trigger.isDelete){
for(Student__c s:trigger.old){
ids.add(s.Course__c);
}
}
list<Course__c> x= new list<Course__c>();
// list<Course__c> cors=[select NUmberOf_Student__c,(select Course__c from Students__r)from Course__c where id=:ids];
list<course__c> cors=[select name, NUmberOf_Student__c,(select id,Course__c from Students__r)from course__c where id in:ids ];
cors.NUmberOf_Student__c=cors.Students__r.size();
// x.add(cors);
}
/* try{
update x;
}
Catch(Exception e){
System.debug('Exception :'+e.getMessage());
}*/
i am geeting veraiable doesnot exist ie>.Students__r
list<id> ids= new list<id>();
if(trigger.isinsert || trigger.isUndelete){
for(Student__c s:trigger.new){
}
}
if(trigger.isDelete){
for(Student__c s:trigger.old){
ids.add(s.Course__c);
}
}
list<Course__c> x= new list<Course__c>();
// list<Course__c> cors=[select NUmberOf_Student__c,(select Course__c from Students__r)from Course__c where id=:ids];
list<course__c> cors=[select name, NUmberOf_Student__c,(select id,Course__c from Students__r)from course__c where id in:ids ];
cors.NUmberOf_Student__c=cors.Students__r.size();
// x.add(cors);
}
/* try{
update x;
}
Catch(Exception e){
System.debug('Exception :'+e.getMessage());
}*/
i am geeting veraiable doesnot exist ie>.Students__r
Hi Raju,
I believe we are already on this issue at the below link
https://developer.salesforce.com/forums/ForumsMain?id=9060G000000IC6e
If YES, once that is resolved please feel free to mark this issue as closed.
Thanks
Vivian