+ Start a Discussion
Ken Koellner 7Ken Koellner 7 

EventRelation Multiple Leads and IsInvitee

I have some Apex code that inserts Events and EventRelation records and I'm doing a bit of work on it.  It is coded to insert multiple EventRelation records and the relationId field on those records may point to various Leads.  I set IsInvitee on the records to false.  But when I read those records back, the Isinvitee field is being change to true.  I have't found anything on the behavior in the documentation. The documentation appears to state that only one Lead may be associated with the Event but that seems incorrect.  I created an Event with the Lightning UI, and we easily able to start for multiple Leads and add them.  An image is shown below and the records are shown below.

I want to do the same thing in Apex but leave IsInvitee as false.  Anyone know if there's a way to force that? 

 

Both Bertha Boxer and Phyllis Cotton are LEads.
User-added image

Note that both records have 00Q in RelationId indicating a Lead.

AccountId	EventId	Id	IsInvitee	IsParent	IsWhat	RelationId	Status
1		00U2M00000QFPxZUAX	0RE2M00000MrGQQWA3	true	false	false	00Q4100000JQczNEAT	New
2		00U2M00000QFPxZUAX	0RE2M00000MrGQPWA3	true	false	false	00Q4100000JQczOEAT	New

 
SwethaSwetha (Salesforce Developers) 
HI Ken,
Can you share a simplified code snippet that I can use to repro this behaviour on my org so I can suggest better?Thanks