pse.ScheduleServiceglobal with sharing class ScheduleService A service that provides functionality relating to schedules. To understand schedules, call this service rather than query Schedule and ScheduleException separately and interpret the results. To make simple updates to existing schedules associated with assignments or resource requests, call this service rather than use DML on Schedule and ScheduleException separately. Methods
getScheduledHoursForDatesglobal static Map<Id, pse.ScheduleService.HoursDetail> getScheduledHoursForDates(Set<Id> scheduleIds, Date startDate, Date endDate) This method does all the logic of looking at the specified schedules and their schedule exceptions and working out how many hours the resources are scheduled to work on specific dates. Input Parameters
Return ValueA map keyed on Schedule Id. The values detail the scheduled hours after schedule exceptions have been considered. Sample Code
updateSchedulesglobal static List<pse.ScheduleService.UpdateScheduleResponse> updateSchedules(List<pse.ScheduleService.UpdateScheduleRequest> requests) Amends the specified schedules and their schedule exceptions to change specific dates to the hours indicated in the request. If you want to make extensive changes to the schedule, such as changing the pattern for the whole scheduled period or altering the end date, we recommend that you use the pse.SchedulingStrategyService API. The return value contains one response for each request and indicates if the request was valid. For example, a request is invalid if you attempt to change a date outside the range of the schedule. Any DML errors are thrown as exceptions. Sample Code
consolidateExceptionsOnSchedulesglobal static List<pse.ScheduleService.ConsolidateScheduleExceptionsResponse> consolidateExceptionsOnSchedules(Set<Id> scheduleIds) This method looks at the specified schedules and schedule exceptions and then combines the exceptions which have identical hour patterns over consecutive weeks. The scheduled hours on each date will not change, but the number of schedule exception records used may be reduced. Input Parameters
Return ValueA list of responses has one response for each schedule which indicates if the request is valid. For example, a request is invalid if you attempt to correct a schedule having zero or one exception. Sample Code
saveScheduleDataglobal static List<pse.ScheduleSaveDTO.SaveResult> saveScheduleData(List<ScheduleSaveDto> data, Boolean allOrNone) This method saves the provided schedule data. It combines different types of DML operations on pse__Schedule__c and pse__Schedule_Exception__c for ease of use. It also prevents issues that could arise from a sequence of saves causing the data to be temporarily invalid before reaching a valid state.
This method requires the following security permissions
The data is saved synchronously, however side effects that can happen asynchronously (depending on settings) include:
If the allOrNone flag is false, any schedules that fail validation and their schedule exceptions will not be saved. This flag applies to all DML statements used to save schedules and exceptions. If some schedule exceptions fail to save due to errors, others might still succeed even on the same schedule. If a schedule fails to save, no attempt will be made to save its exceptions. You can inspect the SaveResult object to identify DML errors. If the allOrNone flag is set to true, any errors will result in an exception being thrown. Input Parameters
Return ValueAn array of results that matches the input data. Sample Code
pse.ScheduleService.HoursDetailglobal inherited sharing class HoursDetail Properties
pse.ScheduleService.UpdateScheduleRequestglobal inherited sharing class UpdateScheduleRequest Use instances of this object with updateSchedules to edit schedules. Properties
pse.ScheduleService.UpdateScheduleResponseglobal inherited sharing class UpdateScheduleResponse Response object returned from updateSchedules. Use the ScheduleId to match it to a request. Properties
pse.ScheduleService.ConsolidateScheduleExceptionsResponseglobal inherited sharing class ConsolidateScheduleExceptionsResponse Response object returned from consolidateExceptionsOnSchedules. Use the ScheduleId to match it to a request. Properties
|