• vishnu vardhan 142
  • NEWBIE
  • 0 Points
  • Member since 2018

  • Chatter
    Feed
  • 0
    Best Answers
  • 0
    Likes Received
  • 0
    Likes Given
  • 3
    Questions
  • 0
    Replies
Hi All,

How to write soql Query to get recently created 10 records from an Object
Hi All

I have a scenario like 

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