Show a list of events on visualforce page, and give ability to respond as accept/reject/maybe.
- 3 users are participating in an event.
- Event is created by a user named "Ab Jindal" and he invites two other sfdc users i.e. "Ab Dev" and "Sm Dev"
- Here is event data with parent event and eventrelations created for owner "Ab Jindal"
- EventRelation table data for this event:
From above screenshots, its clear that one needs Parent Event Id to update any EventRelation. Even if we try to hack and create a new EventRelation record via invited user i.e. "Ab Dev" or "Sm Dev", it will fail. Here is sample failure code
EventRelation er = new EventRelation( RelationId = UserInfo.getUserId() , EventId = '00U2000000VcrubEAB', Status = 'Declined' ); insert er;
Here is the error which comes on executing above code:
System.DmlException: Insert failed. First exception on row 0; first error: INVALID_OPERATION, You cannot create an Event Relation with a child event.: [EventId]
So, I wanted to know either of following two questions:
- How we can get parent event id from a child event ?
- Or, how to update child event with accept/decline/maybe info ?
On researching found this post which is somewhat close to my challenge, but is not having correct resolution.