function readOnly(count){ }
Starting November 20, the site will be set to read-only. On December 4, 2023,
forum discussions will move to the Trailblazer Community.
+ Start a Discussion
advlgxadvlgx 

Get the Master or Parent Event ID from a series of Events with multiple attendees

When you create and event with multiple attendees, 1 event record is created for each attendee. Is there a definitive way to determine which is the source or master event of the group?

 

In the data, all events would have IsGroup=true. The event records created for the added attendees would have IsChild = true.

 

Question is, if I only have the event of one of the child records, how can I programatiically determine what the master or source event is for the group that the child event belongs to?

Saurabh DhobleSaurabh Dhoble
Tricky one, unfortunately, it looks like there's no clear cut way of knowing which is the "parent" event - 
Given an Event ID, to find it's parent, look for an event that has -
a. The same WhatId
b. The same subject
c. IsChild = false

This is the closest I could get. The only bug in this approach is that if you have two events with exactly the same subject, under the same activity, the query will return two parent events. I don't know how to get around that.

Here's the query I used for an event called "Another Test" that I created - I would get the What ID from the "Child" event -

select id, isChild, subject, whatId, whoId, groupeventtype, isgroupevent, isprivate, ownerid, accountid from event 
where ischild = false and subject = 'Another Test' and WhatId = 'a04E000000GgMtlIAF'
Let me know if this works. -- and please mark this as answer if it does.