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 Date.today()+2. But, the activity date is not getting updated with the given value as Date.today()+2. 
Below is the my assignment for activitydate in the trigger:
ActivityDate = Date.today()+2


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.

Thanks, 
Rohitsharma

KeerthigeeKeerthigee
Hi Rohit,

On which object you want to do this?

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

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

ActivityDate = Date.today().addDays(2)


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