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
sandipmsandipm 

test data for events?

Hi ,

 

 I want to write test cases for Event related functionality. I am stuck at creating test data for

  EventAttendees. as EventAttendees are child to Event. and they can be either Contacts, Users or Leads.

 

anyone help me with this?

 

regards,

Sandip  

micwamicwa

Just create Contacts, Lead or Users first and then the EventAttendee. An example could look as follows:

 

Account a = new Account(Name = 'test');

insert a;

Contact c = new Contact(LastName = 'Tester', AccountId = a.Id);

insert c;

Event e = new Event();

//more code to define event

insert e;

 

//now create attendeeEventAttendee

ea = new EventAttendee();

ea.Status = 'the status';

ea.EventId = e.Id;

ea.AttendeeId = c.Id; //this could also be a lead or a userinsert ea;

 

 

 

Message Edited by micwa on 12-23-2009 04:06 AM
sandipmsandipm

Yes i tried the same before ...but it didnt allow me to add attendeeId saying its not writable.

 

Later I read somewhere that Eventattendees can not be added from apex class.

 

 

regards, 

sandip 

JimRaeJimRae

Currently it is not supported. The only thing you can do, not great, but a solution, is to create some test events in your dev and production environments that you can query for to do your testing.

 

Vote for this idea on the IdeaExchange as well:

 

Unlock EventAttendee in the APIUnlock EventAttendee in the API