I am creating a task via trigger which is working fine, but how to update this remainder field value via trigger.
even in page layout also it is not visible and in "Task fields " also it is not there
The name is: ReminderDateTime
Documentation link here: https://developer.salesforce.com/docs/atlas.en-us.api.meta/api/sforce_api_objects_task.htm
From the ObjectReference, there are two fields that are needed. The first is a boolean, IsReminderSet
. If that field is set to true, then the field ReminderDateTime
(Date-Time) can be updated.
Description: Represents the time when the reminder is scheduled to fire, if IsReminderSet is set to true. If IsReminderSet is set to false, then the user may have deselected the reminder checkbox in the Salesforce user interface, or the reminder has already fired at the time indicated by the value.
Try this :
As per doc : https://developer.salesforce.com/docs/atlas.en-us.api.meta/api/sforce_api_objects_task.htm
trigger taskreminder on Task (before update, before insert) {
for(task t : trigger.new){
if(t.ReminderDateTime!= null){
t.IsReminderSet = true;
t.ReminderDateTime = system.now();
}
}
}