I want to add "User" invitees to an event through eventRelation. I am doing this through an additional Event.OwnerId field in the custom layout. When the user saves the record for event, an eventRelation record should be created.
This is the code I have written so far...
EventRelation eventR = new EventRelation(); eventR.EventId = evnt.Id; eventR.RelationId = evt.OwnerId; eventR.isWhat = false; eventR.isParent = false; eventR.IsInvitee = True; eventR.Status = 'New'; insert eventR;
In the code above i am getting the eventId once the event record has been inserted. After that i am creating the eventRelation record with the additional OwnerId field value placed in the layout.
The problem is that eventRelation record is created at first with an insert id being returned without any errors or exception of any kind but later when the EventRelation is queried, the record is gone.
I also tried to set the GroupEventType to 1 (required for multiple invitees) but this field was not writable.
Note: Activity sharing feature is enabled
Any help will be appreciated.