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
ShyluShylu 

Update WhoID on Task using Trigger

Hi all,

I need to update whoid on task and here is my simplified trigger which is not working.

trigger UpdateWhoID on Task (before insert, before update)
{
        for(Task t:Trigger.new)
        {
                t.whoid='003c000000csRby';    
        }
}

Note: Shared Activities is enabled in the organization.
Best Answer chosen by Shylu
kevin lamkevin lam
It's not updateable when Shared Activities is enabled:

https://developer.salesforce.com/docs/atlas.en-us.apexcode.meta/apexcode/apex_triggers_fields_not_updated.htm