+ Start a Discussion
raysfdc1988raysfdc1988 

Tirgger to update a field on parent object accourding to the datevalue

I have parent object called-->student
and Child object called -->attendence
and in parent object filed called-->Current_month_attendence_count 
and date field -->in child object
Now  every time Attendence record is created for perticular student then  Current_month_attendence_count increased by one
This can be achiveble by using a Rollup Summary field 
But I want Count the total no attendence record of perticular student only for Current Month..
We cant add a Rollup Filter like Date Equals THIS MONTH

So i need to update Current_month_attendence_count field when Date__C (field in child object attedance) is Equals to THIS MONTH

I think this can be achivieble by Trigger...
Pl suggest me wit best solutions...thanks


Now i want update field Current_month_attendence_count filed in parent object..
RamuRamu (Salesforce Developers) 
Yes, it is possible to do this through trigger. However, you would need to have a date field on the parent object whose month can be compared with the month value of attendance date field to see if the month is still the current month or new month. Based on this we can either increment the count by 1 or keep it as it is.
raysfdc1988raysfdc1988
Thanks Ramu..
Please can give me code...I am new to in apex..
Even Logic also helps me lot..

Please help me