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

Event field not writable?

Get an error on this ...

newEvent.AccountId = '0017000000NB5vCAAT';

I need to write new events with Apex. I'll need to set the AccountId to which the event is related.

I get an error : Error: Compile Error: Field is not writeable: AccountId at line 51 column 5

What can I do to write an AccountId to the AccountId field in Event?
use the whatid field