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
SFDC coderSFDC coder 

how to get all the invitees associated to an event?

hi all,
i need to get the ids of all the contacts associated to an event.
i.e the contacts that we add into the name field.
However,when i query the whoId field,i just get the primary contact id and not all the other assciated contact ids.

can anyone please help?
Best Answer chosen by SFDC coder
EnreecoEnreeco
Try to query the EventRelation SObject (http://www.salesforce.com/developer/docs/api/Content/sforce_api_objects_eventattendee.htm), with "IsWhat = false" and "IsParent = true".
This should work.

--
May the Force.com be with you!

All Answers

EnreecoEnreeco
Try to query the EventRelation SObject (http://www.salesforce.com/developer/docs/api/Content/sforce_api_objects_eventattendee.htm), with "IsWhat = false" and "IsParent = true".
This should work.

--
May the Force.com be with you!
This was selected as the best answer
RamuRamu (Salesforce Developers) 
So basically there are 3 things you need to know about Events
1. Whoid= This consist of ID of Contact or Lead associated to the event(In UI it will be the 'Name' field)
2. Whatid = Thhis consist of ID of objects other than Contact/Lead (it will be with the name 'Relatedto' in UI)
3. EventRelation = This is a seperate object that holds the related records (Invitees in the UI).

To answer your question, you would need to query for Event and Eventrelations table to get all the information you need

Eg : select id,(select id from eventrelations) from event where id='00U9000000VuDR6'

Hope this helps !!
David Roberts 4David Roberts 4
I've been trying to add the attendees as a related list on my custom controlled apex page but can't find a syntax that works.
I get errors like: "'EventRelations' is not a valid child relationship name for entity Event "

<apex:relatedList subject="{!anEvent}" list="EventRelations">
        <apex:facet name="header">Attendees</apex:facet>
    </apex:relatedList>

where "anEvent" is my event record (public Event in controller) which succesfully returns all the fields of the event in a pageBlock.

Any ideas?
sumitra assumitra as
If you are facing issues in your internet or having troubles to change the settings of your ISP, then do check out: https://ispsettings.co/
Martin LaretopeMartin Laretope
RingCentral Alternative https://leadmanagement.reviews/
taylor godivataylor godiva
Geometry Dash Scratch (https://geometrydashscratch.io) currently includes 21 official levels. It is famous for its extensive level creation system, where players can create their own custom levels, share them online, and play levels designed by other players.
Tech Gadget 360Tech Gadget 360
Letter writing is an enduring art form that allows us to establish profound connections in a world dominated by digital communication. Amidst the flurry of emails and instant messages, the elegance of taking up a pen and paper holds a unique charm. Each stroke of the pen not only conveys words but also emotions and personality, preserving an intimacy that technological interactions often lack. Whether we're penning down a passionate love letter, expressing gratitude, or offering motivation, the act of writing a letter weaves bonds that withstand time. For valuable insights and guidance on enhancing your letter writing skills (https://thehindiinsider.com/informal-letter-format-in-hindi-importance-examples-faqs/), you can explore the resources available at The Hindi Insider Informative Blog (https://thehindiinsider.com), where the beauty of this traditional method of expression is celebrated. Discover more about the intricacies of letter writing and embrace its timeless allure through their platform.