Newer Version Available
EventRelation
EventRelation allows a variable number of relationships and handles deleted events differently, depending on whether Shared Activities is enabled.
- If Shared Activities Is Enabled
-
- An event can be related to up to 50 contacts or one lead.
- If you delete an event, then relations between the event and any specified contacts, leads, and records are also deleted. The WhoId, WhatId, and AccountId field values are cleared. If you restore a deleted event, relations between the event and any specified contacts, leads, and records are also restored. The WhoId, WhatId, and AccountId field values are recalculated using the field values on EventRelation.
- If Shared Activities Isn’t Enabled
-
- An event can be related to only one contact or lead.
- If you delete an event, the WhoId, WhatId, and AccountId field values aren’t cleared.
Whether or not Shared Activities is enabled, an event can be related to one other kind of record, such as an account, an opportunity, or a custom object (in addition to one or more contacts).
Supported Calls
create(), delete(), describeSObjects(), getDeleted(), getUpdated(), query(), queryAll(), retrieve(), update(), upsert()
Fields
| Field | Details |
|---|---|
| AccountId |
|
| EventId |
|
| IsDeleted |
|
| IsInvitee |
|
| IsParent |
|
| IsWhat |
|
| RelationId |
|
| RespondedDate |
|
| Response |
|
| Status |
|
Usage
- Send email notifications
- To send email notifications for a given event, query EventRelation for the event, iterate through the list, examine the status, and send email notifications to every person who accepted the invitation.
- Determine what events a given invitee is attending
- To determine all the events that a particular person is attending during a given time period (for example, next week), you can have a client application query the Event object for a given date range, iterate through the results, and, for each event, query the EventRelation object to determine whether the particular person (RelationId) has accepted an invitation to that event.
- Create an invitee if Shared Activities is enabled (or during the process of enabling it or rolling back)
- If the invitee is already a contact or lead, update IsInvitee to true.
- If the invitee is not already a contact or lead, create an EventRelation object for the invitee with IsInvitee set to true.
- Create an invitee if Shared Activities is not enabled
- Create an EventRelation object for the invitee.
- Query relations to a contact or a lead
-
- Query invitee relations
-
- Update an invitee relation to a contact or lead invitee relation
-
- Update a contact or lead relation to a contact or lead invitee relation
-
- Insert a contact or lead relation
-
- Insert an invitee relation
-
If isParent, isWhat and IsInvitee are not set, and RelationId is a contact, lead, user, or calendar, IsInvitee defaults to true. This means if an EventRelation isn’t specifically inserted as a relation to a contact or lead, it’s treated as an Invitee relation by default.