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
OldDeadBugOldDeadBug 

WhatID on the Email object???

The Apex Developer Guide says the setWhatID method requires an id, and'The value must be one of the following types:"

 

It then lists standard Objects as well as Custom. 

 

Is the expected value the 3 character prefix? the prefix with 12 '0's

behind it, or the Record ID, or what?

 

 

micwamicwa

No you have to specify a concrete SF Id of a record of type (see list in Developers guide).

 

It means that the specified Id must be of type Account, Asset, or any custom object. It can't for example reference a record id of a contact because contact is not in the list and is not a custom object.

 

 

Id accountId = [Select a.Id from Account a where Name = 'xx' limit 1].Id; x.setWhatId(accountId);