I am getting this Salesforce Exception:

"FIELD_INTEGRITY_EXCEPTION, Opportunity/Account ID: id value of incorrect type: a4tS00000008dtBIAQ: [WhatId]"

while trying to create a Task on custom object using Apex code.

I am storing Object id in to ID field like ID whatId = record.id; and setting it in Task object whatId field.

I am not able to add Task on custom object using object Tab. I am not getting any option to create task on that object.

1 Answer 1


Edit your custom object and check the 'allow activities' checkbox. This should solve your problem.


You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .