You need to sign in to do that
Don't have an account?

Setting the reminder of recurring Tasks
When creating a recurring task using Apex, how I can set the reminder to get the same functionality as what UI offers?
The Task object has only a "ReminderDateTime"!
Task t = new Task();
t.Subject = 'Test';
t.IsReminderSet = true;
t.RecurrenceType = 'RecursEveryWeekday';
t.RecurrenceDayOfWeekMask = 62;
t.ReminderDateTime = ?? //this is a date time field, How to set to : "On occurrence date" at "8:00 am" for each occurrence?
insert t;
ReminderDateTime should be in the Date Time Format.
Hence why I have this question!!
How I can set the reminder for the recurring task?
For ex : Datetime myDate = Datetime.valueOf('2013-06-14 15:15:15');
assign myDate to ReminderDateTime
'YYYY-mm-dd hr:min:sec'
Not sure how to make myself clear:
See the picture below, when setting the reminder for recurring Task, options are different:
This should help you .
Datetime myDate = Datetime.valueOf('2013-06-14 15:15:15');
task tasks = new task();
tasks.IsRecurrence = true;
tasks.RecurrenceStartDateOnly = date.newinstance(2013, 6, 17);
tasks.RecurrenceEndDateOnly = date.newinstance(2013, 7, 17);
tasks.RecurrenceType = 'RecursDaily';
tasks.RecurrenceInterval = 3 ;
tasks.IsReminderSet = true;
tasks.ReminderDateTime = myDate;
insert tasks;
Thanks for your response.
So If I want to set the reminder to:
notify me: 3 days before each occurance at 10:30 AM
What should I set in the DateTime value?
Just to understand the logic.
If I was to set the DateTime value for one time reminder, I already know how one can set a DateTime value in Apex.
Try this :
Datetime myDate = Datetime.valueOf('2013-06-24 10:30:15');
task tasks = new task();
tasks.IsRecurrence = true;
tasks.RecurrenceStartDateOnly = date.newinstance(2013, 6, 27);
tasks.RecurrenceEndDateOnly = date.newinstance(2013, 7, 17);
tasks.RecurrenceType = 'RecursDaily';
tasks.RecurrenceInterval = 3 ;
tasks.IsReminderSet = true;
tasks.ReminderDateTime = myDate;
insert tasks;