+ Start a Discussion

Task - Account link

In the describe response of the Task entity there is a field called the whatID and a field called accountID. How does the accountID field of a task get set? I couldn't find any way of setting it (or viewing it) on salesforce.com, however I can get a value for the accountID when I pull down the task via XML-RPC. The trouble arises when I want to update this accountID value, or insert a new task with an accountID value, I get a fault saying "1236, bad field names on insert/update call: accountID". If instead of insert/update to the accountID field, if I insert/update to the whatID field, what happens to the accountID field? Does that get set if the whatID is an accountID?



mike kreadenmike kreaden


Simple answer:  As you notice (via the describe call), the accountID cannot be set by an insert or update call directly.  This value is automatically set on insert, when you set the whoID field value to a Contact ID and do not set a value for the whatID.

More complicated follow-up:  If (and only if) you want to change the value of the accountID on Update to a Task, you must set the whatID manually to the value (Account ID) in question.  This will force the accountID to change after the update call completes.