1

I Salesforce Sites set up on a sandbox org. I'm trying to create an Event to be added to a specific user's calendar when a Guest user clicks Save on the public Visualforce page below.

enter image description here The page's custom controller:

public class MyEventController {
  public MyEventController() {
  }

  public Datetime AppointmentDate { get; set; }

  public Pagereference Save() {
    Event event = new Event(Subject = 'New Event');
    event.Type = 'Meeting';
    event.Location = '123 main st';
    event.StartDateTime = this.AppointmentDate;
    event.EndDateTime = this.AppointmentDate; 
    insert event;
    return null;
  }
}

Currently, when the Site Guest User clicks Save, the event shows on the System Administrator's calendar.

How can the event be inserted to another, specific user's calendar?

Thank you

1 Answer 1

1

Change the OwnerId to the user you wish to assign it to.

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .