public class attendance
{
public static void Test(Session__c [] session)
{
List<Attendance__c> att = new List<Attendance__c>();
Date obj = Date.today();
for (Session__c s:session)
{
for(Enrollment__c e : [Select Contact__c From Enrollment__c where Program__c =:s.Program__c])
{
try
{
att.add(new Attendance__c(Present__c =false, Excused_Absence__c =false, Excuse_Details__c='',date__c = s.Session_Date__c, Youth__c = e.Contact__c, Session__c = s.id));
upsert att;
}
catch(DmlException d)
{
d.getMessage();
}
}
}
}
}
No comments:
Post a Comment
Share your Comments .............