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
Rohit SharmaGRohit SharmaG 

Update ActivityDate of Task via EmailMessage trigger

Hello Dears,

I wrote a trigger on the EmailMessage to create a task with the due date value woulde be But, the activity date is not getting updated with the given value as 
Below is the my assignment for activitydate in the trigger:
ActivityDate =

But, it is not updating with the given value. By default, it stores today's date.

Please suggest me how to update this field while creating a task.


Hi Rohit,

On which object you want to do this?

you can try this  "Lastactivitydate" in place of activity date.

Prafull G.Prafull G.
Rohit, use addDays(Integer days) method instead.

ActivityDate =

Rohit SharmaGRohit SharmaG
its not working. Please let me know if any other solutions.