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.


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


Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.