+ Start a Discussion
Rakshana Cube84Rakshana Cube84 

How can I write SOQL query for returning invitees for an event in sfdc

Hi All,
Please help me to write a query for returning invitees for an event which has been invited a user. I have researched already about it, I got "isinvitee" boolean value for ensuring the user has invited or not. But I can't see the field name in that Event object.

Thanks,
Rakshana
Aamir KhanAamir Khan
Aloha,

Yes! you can do it but not with IsInvitee instead RelationId.

EventRelation

Represents a person (a user, lead, or contact) or a resource (such as a conference room) invited to an event. This object lets you add or remove invitees from an event and use the API to manage invitees’ responses to invitations. If Shared Activities is enabled, EventRelation can also represent other objects that are related to an event. EventRelation does not support triggers, workflow, or data validation rules.
EventRelation allows a variable number of relationships and handles deleted events differently, depending on whether Shared Activities is enabled.
A non-recurring event can have up to 1,000 invitees. A recurring event can have up to 100 invitees.

RelationId
Type: reference
Properties: Create, Filter, Group, Sort
Description: Contains the ID of the person (User, Contact, or Lead) or the resource invited to an event. When Shared Activities is enabled, RelationId can also contain the ID of an account, opportunity, or other object related to an event.
This value can’t be changed after it’s been specified.

Here is the SOQL query:
SELECT id,EventId,RelationId FROM EventRelation

Hope this helps.

Mhalo,
Aamir AH Khan,
Lead Salesforce Lightning Developer