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
miku1051miku1051 

how to add more than 1 invitee(whoid) to an event using code…?

i want to insert an event record...but like i have more than 1 lead..i want to insert more than 1 leads as an invitee...

Like using whoid we can insert 1 record ... Using the standard interface we can click on add to inviteesbutton and add multiple invitees..How to add multiple using code so that it shows below on salesforce events...any help will be appreciated...

 

Event e= new Event();
e.Subject='Call';
e.ownerid=userinfo.getuserid();
e.StartDateTime=datetime.now().adddays(5);
e.EndDateTime=datetime.now().adddays(5);
e.WhatId=recid;
**//e.WhoId=**
insert e;
Best Answer chosen by Admin (Salesforce Developers) 
sfdcfoxsfdcfox
Use the EventRelation object (must be version 26.0 or higher code). See the following documentation:

http://www.salesforce.com/us/developer/docs/api/Content/sforce_api_objects_eventattendee.htm

Hope this helps.

All Answers

sfdcfoxsfdcfox
Use the EventRelation object (must be version 26.0 or higher code). See the following documentation:

http://www.salesforce.com/us/developer/docs/api/Content/sforce_api_objects_eventattendee.htm

Hope this helps.
This was selected as the best answer
miku1051miku1051
thanks mate...worked perfectly...
Subbu'sSubbu's

hii ,

Can u share me code how you acheived this..Becoz  i need the same functionality