You need to sign in to do that
Don't have an account?
OldDeadBug
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?
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);