• Ken Koellner (9 of 12)
  • 0 Points
  • Member since 2018
  • Lead Salesforce Architect
  • TimeTrade Systems Inc.

  • Chatter
  • 0
    Best Answers
  • 0
    Likes Received
  • 0
    Likes Given
  • 1
  • 1
I'm looking for a way to represent something like a seminar where they are many attendees that are clients.  Some of these clients will be represented by Contact records and some Lead records.
I'd like to use Event and EventRelation but there are some odd restrictions that I don't see a work around for--
In Lightning, EventRelation records are shown on Event (in the Name related list) only when isParent is true and either one Lead and no Contacts or any number of Contacts but no Leads can have that field set.  With a mixed group, that means the Name related list on Event can really only be used to show Contacts. 
Now looking on related listed the Events on Contacts.  That works in both Classic and Lightning I can get the Open Activities related list and Activity Related history and the Events show up.
But for Lead, I can't get the Events listed (as I have to set isParent to false and they only show in the Activities related lists if isParent is true).
So considering the following use cases--
1. For a seminar with both Leads and Contact attending -- List all Leads and Contacts.
2. For a Contact -- list all the seminars they attend.
3. For a Lead -- list all the seminars they attend.
Case 1 works in Classic but not Lightning.
Case 2 works in Classic and Lightning.
Case 3 does not work in Classic or Lightning.
Anyone have suggestions for the best way to data model?
The one thing I've thought of is use native Event but add a custom related object.  Then put that related list on all three objects.

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..