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
mike1051mike1051 

associating event with lead(Activity history)…?

I am inserting events and inserting multiple invitees(Lead/Contacts) to event using EventRelation.

EventRealtion er = new EventRelation(EventId = '00UD0000005zijH', 
RelationId = '003D000000Q8adV');
insert er;

problem is when i add invitees using event relation...they dont associate it with lead/contact as event in activity history..they only associate when i put whoid in that event.then it associates automatically...but we can add only 1 whoid to an event..

How can i associate lead with events...can someone provide me a solution for the same..??? any help will be appreciated..

Vinita_SFDCVinita_SFDC

Hello Mike,

 

If the Start Time of the event has yet to occur, the event will be listed within the record's Open Activities related list.  Once the event starts (actual time of day within the application equals Start Time of the event), the event record will move from the Open Activities related list to the Activity History related list. 

 

Example:  An event has a Start Time of 9 am, an End Time of 11 am the same day, and it's related to a contact.  The event record under the contact's Open Activities related list will move to the contact's Activity History related list at 9 am the day of the event.       

 

Note: The Start Time is the only trigger to move the event from one related list to another.  It's not based on Start and End Time or End Time alone. 

miku1051miku1051

Thanks Vinita for your reply.

 

I know what you saying...but my problem is when i am inserting multiple invitees using event relation..it is not associating itself with lead/contacts in open activities/activity history.

 

Its associating itself only when i insert any lead/contact in whoid of an event but not when i insert using event relation object.

 

Did you understand what i am saying..???

Ken Koellner  (9 of 12)Ken Koellner (9 of 12)
You'll see the Lead if you set isParent = true on the ER record.  There's a restriction that only one Lead ER record can have isParent to true for an Event and if you have one, no Contacts can have it true.  That's not true for Contacts.  You can have several Contacts with isParent equal true are ER recs on the same Event as long  you you don't have one for a Lead.