The following sample updates an appointment record with given unique key.
//for this sample, it is assumed that an appointment record already exists with a unique key String equal to uniqueKey
protected AppointmentRepository appointmentRepository;
public void test_updateAppointment() throws Exception {
Date date = new Date();
AppointmentUpdate appointment = new AppointmentUpdate();
//use the setUniqueKey method to identify the target task record to update by its unique key
appointment.setUserUniqueKey("user_1003");
appointment.setAssignedOn(date);
appointment.setStartOn(date);
appointment.setEndOn(date);
appointment.setAllDay(true);
appointment.setProjectUniqueKey("DISP_0003");
appointment.getAttendeeUpdates().add(attendees);
appointmentRepository.updateAppointment(appointment);
}
private List<AttendeeUpdate> attendeeUpdate() {
List<AttendeeUpdate> attendees = new List<AttendeeUpdate>();
AttendeeUpdate attendee1 = new AttendeeUpdate();
//identify which attendee to update by the record's unique key
attendee1.setUniqueKey("ATTN_1001");
attendee1.setUserUniqueKey("USER_1005");
attendee1.setAttendanceType(AttendanceType.WILL_NOT_ATTEND);
attendees.add(attendee1);
return attendees;
}