In a test class I need to create an event object, and I want to assign the fields WhoId and WhatId. For now I wrote that in my test class:
Account c= new Account(FirstName = 'test',
LastName = 'test');
insert c;
Event ev = new Event(StartDateTime = DateTime.now(),
EndDateTime = DateTime.now(),
Subject = 'Appel',
WhoId = c.Id,
WhatId = c.Id);
insert ev;
but when I run the test class, I got the error :
System.DmlException: Insert failed. First exception on row 0; first error: FIELD_INTEGRITY_EXCEPTION, Name ID: incorrect type ID value;: 0017E00000BQTraQAH: [WhoId]