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
Tasia Demuth 4Tasia Demuth 4 

Help create new records using the whoIds from an event

Hi team Developer!

I am hoping you can help me with this tricky request. Our org has a custom object called Meeting__c and a related custom object called Attendee__c. These custom objects are used to hold notes about internal meetings and to list everyone who attended the meetings. 

What I want to do is if an Event is associated to a meeting, I want to take all of the Event attendees and create meeting attendees. Below, I believe I have the code needed to look up the Event attendees. But, then I go stuck as to where I go next to create the meeting attendees. 

Any help would be much appreciated! Thank you so much for your help!

trigger CreateAttendeesfromEventInvitees on Event (after insert, after update) {

For (Event EVT:trigger.new){
    List <eventRelation> Erelates =[select RelationId,WhoId from eventRelation where eventID=: EVT.id]; 
    Set<Id> erelateSet = (new Map<Id,eventRelation>(Erelates)).keySet();
    Set<Id> erelateSet = new Set<Id>();
    for(EventRelation evtRel : Erelates){
    erelateSet.add(evtRel.WhoId);
}
Deepali KulshresthaDeepali Kulshrestha
Hi Tasia,

Start your Process Builder process on Task (only when a record is created)

Entry Criteria:
Field = [Task].WhoId
Operator = Starts with 
Type = Formula
Value = "003

Immediate Action:
Update Account on Task
Field = Related to ID
Type = Formula
Value = [Task].AccountId
User-added image
User-added image


I hope you find the above solution helpful. If it does, please mark as Best Answer to help others too.

Thanks and Regards,
Deepali Kulshrestha
Tasia Demuth 4Tasia Demuth 4
Hi Deepali!

I think that would work if only one contact is associated to the task. But, if many whoIds are associated, then that is when I have trouble. I am having trouble having it loop through all the contacts that might be on an event. 

Let me know what you think!

Thanks,
Tasia