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
vishnu vardhan 142vishnu vardhan 142 

Trigger on Class Object After Insert, After Update If Active checkbox is checked on Class record then Create 7 Child Future (Date >= today) coaching session records

Hi All
I unable to create the trigger for the below scenario,Someone pls help me out.

1 Trigger on Class Object
2 After Insert, After Update
3 If Active checkbox is checked on Class record then
    1  Create 7 Child Future (Date >= today) coaching session records 
    2  The Date range will determine the class date for Coaching Session record
    3 The Date range will be generated from First Class Date field on the Class Record
    4  For e.g. if an active Class record is created with a First Class Date of 1/9/2017
        1  Then generate a date range with +7 days from this date
        2  So the date range will be 1/9/2017 to 1/16/2017
        3 Loop through this date range 
            1 check if the date is in future
            2 if yes then create a Coaching Session Record with class id pointing to the newly created or update class
    5 if an active class record is created with a First Class Date of 1/3/2017
        1  Then generate a date range with +7 days from this date
        2  So the date range will be 1/3/2017 to 1/10/2017
        3 Loop through this date range