pse.TeamScheduleServiceglobal with sharing class TeamScheduleService This class contains the Team Schedule API implementation, including sub-classes for team schedule creation requests. Methods
createTeamScheduleFromTemplateglobal Set<Id> createTeamScheduleFromTemplate(Id teamId, List<pse.TeamScheduleService.CreateTeamScheduleFromTemplateRequest> createTeamScheduleFromTemplateRequest) This method creates a new team schedule from a team schedule template using the details provided from the CreateTeamScheduleFromTemplateRequest list. Input Parameters
Exceptions Thrown
Return ValueThis service returns the ids of the newly created team schedules. Sample Code//Note: This sample code is for demonstration purposes only. It is not intended for //use in a production environment, is not guaranteed against defects or errors, and //is in no way optimized or streamlined. // This is sample code for creating a team schedule from a team schedule template using the TeamScheduleService API. static void testCreateTeamScheduleFromTemplate() { /** * The CreateTeamScheduleFromTemplateRequest class extends the CreateTeamScheduleRequest so that you can create an instance of CreateTeamScheduleFromTemplateRequest. * Here we are creating two team schedules for team1 on 3 March and 4 March by using the team schedule template. */ Date schDate1, schDate2; Id teamId = team1.id; Id templateId = template1.Id; schDate1 = date.valueOf('2017-03-03'); schDate2 = date.valueOf('2017-04-03'); // Creates an instance of the CreateTeamScheduleFromTemplateRequest class with a default constructor. TeamScheduleService.CreateTeamScheduleFromTemplateRequest createSchReq1 = new TeamScheduleService.CreateTeamScheduleFromTemplateRequest(teamId, schDate1, templateId); TeamScheduleService.CreateTeamScheduleFromTemplateRequest createSchReq2 = new TeamScheduleService.CreateTeamScheduleFromTemplateRequest(teamId, schDate2, templateId); // Creates a list of CreateTeamScheduleFromTemplateRequest objects. list<TeamScheduleService.CreateTeamScheduleFromTemplateRequest> listCs = new list<TeamScheduleService.CreateTeamScheduleFromTemplateRequest>(); listCs.add(createSchReq1); listCs.add(createSchReq2); // Creates an instance of the TeamScheduleService class. TeamScheduleService cls = new TeamScheduleService(); // Calls the createTeamScheduleFromTemplate API method. Set<Id> result = cls.createTeamScheduleFromTemplate(teamId, listCs); System.assertEquals(2, result.size()); } createCustomTeamScheduleglobal Set<Id> createCustomTeamSchedule(Id teamId, List<pse.TeamScheduleService.CreateCustomTeamScheduleRequest> createCustomTeamScheduleRequest) This method creates a custom team schedule using details provided from the CreateCustomTeamScheduleRequest list. Input Parameters
Exceptions Thrown
Return ValueThis service returns the ids of the newly created team schedules. Sample Code//Note: This sample code is for demonstration purposes only. It is not intended for //use in a production environment, is not guaranteed against defects or errors, and //is in no way optimized or streamlined. // This is sample code for creating a custom team schedule using the TeamScheduleService API. static void testCreateCustomTeamScheduleRequest() { /** * The CreateCustomTeamScheduleRequest class extends the CreateTeamScheduleRequest so that you can create an instance of CreateCustomTeamScheduleRequest. * Here we are creating two custom team schedules for team1 on 3 March and 4 March. */ Date schDate1, schDate2; Id teamId = team1.id; Id scheduleSlotTypeId = scheduleSlotType1.id; schDate1 = date.valueOf('2017-03-03'); schDate2 = date.valueOf('2017-04-03'); // Creates a list of TeamScheduleSlotDetail objects. List<TeamScheduleService.TeamScheduleSlotDetail> slots = new List<TeamScheduleService.TeamScheduleSlotDetail>(); // Creates an instance of the TeamScheduleSlotDetail class with a default constructor and required properties. TeamScheduleService.TeamScheduleSlotDetail s1 = new TeamScheduleService.TeamScheduleSlotDetail('s1', '4:00am', '4:30am', 4.25, 6, scheduleSlotTypeId); TeamScheduleService.TeamScheduleSlotDetail s2 = new TeamScheduleService.TeamScheduleSlotDetail('s2', '5:00am', '5:30am', 4, 6, scheduleSlotTypeId); slots.add(s1); slots.add(s2); // Creates an instance of the CreateCustomTeamScheduleRequest class with a default constructor. TeamScheduleService.CreateCustomTeamScheduleRequest createSchReq1 = new TeamScheduleService.CreateCustomTeamScheduleRequest(teamId, schDate1, slots); TeamScheduleService.CreateCustomTeamScheduleRequest createSchReq2 = new TeamScheduleService.CreateCustomTeamScheduleRequest(teamId, schDate2, slots); // Creates a list of CreateCustomTeamScheduleRequest objects. list<TeamScheduleService.CreateCustomTeamScheduleRequest> listCs = new list<TeamScheduleService.CreateCustomTeamScheduleRequest>(); listCs.add(createSchReq1); listCs.add(createSchReq2); // Creates an instance of TeamScheduleService. TeamScheduleService cls = new TeamScheduleService(); // Calls the createTeamScheduleFromTemplate API method. Set<Id> result = cls.createCustomTeamSchedule(teamId, listCs); System.assertEquals(2, result.size()); } pse.TeamScheduleService.CreateTeamScheduleRequestglobal inherited sharing abstract class CreateTeamScheduleRequest The request structure for the CreateTeamScheduleRequest class. Properties
pse.TeamScheduleService.CreateTeamScheduleFromTemplateRequestglobal inherited sharing class CreateTeamScheduleFromTemplateRequest extends CreateTeamScheduleRequest The request structure for creating a team schedule using the team schedule template. This class extends pse.TeamScheduleService.CreateTeamScheduleRequest Properties
MethodsCreateTeamScheduleFromTemplateRequestglobal CreateTeamScheduleFromTemplateRequest(Id teamId, Date effectiveDate, Id templateId) A default constructor with the minimum required properties. Input Parameters
pse.TeamScheduleService.CreateCustomTeamScheduleRequestglobal inherited sharing class CreateCustomTeamScheduleRequest extends CreateTeamScheduleRequest The request structure for CreateCustomTeamScheduleRequest class. This class extends pse.TeamScheduleService.CreateTeamScheduleRequest Properties
MethodsCreateCustomTeamScheduleRequestglobal CreateCustomTeamScheduleRequest(Id teamId, Date effectiveDate, list<pse.TeamScheduleService.TeamScheduleSlotDetail> slots) A default constructor for the CreateCustomTeamScheduleRequest class with the minimum required properties. Input Parameters
pse.TeamScheduleService.TeamScheduleSlotDetailglobal inherited sharing class TeamScheduleSlotDetail This method is used to map data to its respective DTO. Properties
MethodsTeamScheduleSlotDetailglobal TeamScheduleSlotDetail(String slotName, String startTime, String endTime, Decimal hours, Integer capacity, Id slotTypeId) A default constructor with the minimum required properties. Input Parameters
|