0

I have the following error :

Insert failed. First exception on row 0; first error: FIELD_INTEGRITY_EXCEPTION ... [WhatID]

When I'm trying to create an Event setting the WhatId field with a custom object ID. With Account Id it works.

Event event = new Event();
event.OwnerId = UserInfo.getUserId();
event.Subject = 'Test';
event.StartDateTime = ...;
event.EndDateTime = ...;
event.whatId = (Id)customObjectId; // Here my customObjectID = a01b000000LWZWGAA1

My custom object is not a child of any standard objects. And when I inspect the schema, the whatId field has several Reference To like Account, Contract, Opportunity but my custom object is not listed !

Is it possible to do that ? What am I doing wrong ?

1 Answer 1

1

Ok, I finally found the solution few times after create the post. I let it for help other.

So I needed to check the 'Allow activities' checkbok in the custom object details page (Setup > Create > Objects).

After that, I was able to create an Event.

You must log in to answer this question.

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