I want to dumb down the multi person calendar events in Salesforce so a Salesperson can go to the invitees on the bottom and just enter all the people - users and contacts in one place.

If one adds contacts there, the event does not show in the Contact's related list. The EventRelation field IsParent defaults to FALSE, but updating it to TRUE makes this appear in the Contact's related lists.

Are there other considerations I am missing?

My trigger is below. One thing I can't do yet is limit my query to related contacts. Can't use LIKE '003%' in the id query.

But it does not update.

trigger EventAttendeeCollector2 on Event (after insert, after update) {
    List<EventRelation> eventRelList = new List<EventRelation>();

    eventRelList = [Select RelationId from EventRelation where eventID IN :trigger.new and IsInvitee = TRUE and IsParent=False];


    for(EventRelation rel : eventRelList){
        rel.IsParent = true;
    update eventRelList;



On the second debug, it returns the same list of eventRelations, and shows them to have isParent=true. But nothing changes on the records. It does not commit. I can update the same event and show the same query results repeating every time. If I use a data loader tool to update IsParent on the EventRelations to IsTrue, it commits, and the Event shows in the related lists for the Contacts.

Update - trying an @future method:

trigger EventAttendeeContactConnectorPusher on Event (before insert) {

     List<EventRelation> eventRelList = [SELECT Id, isParent, isInvitee FROM EventRelation WHERE EventId IN :trigger.new 
                                         AND isInvitee = true and isParent = false];

    Set<Id> eventRelSet = (new Map<Id,EventRelation>(eventRelList)).keySet();



public class EventAttendeeContactConnectorHandler {

    public static void EventAttendeeContactConnector(set <id> eventRelSet) {

        list <EventRelation> relations =[select id from EventRelation where id IN: eventRelSet];

        for (EVentRelation rel: relations){
        //update relations; 



1 Answer 1


The @future method works while the trigger does not.

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .