c2g.AllocationScheduleServiceglobal inherited sharing class AllocationScheduleService the service class relating to allocation schedules. EnumsRetrieveTransactionsOptionThe list of valid options for the range of periods to retrieve transactions from when using a RetrieveTransactionsOption of RetrieveTransactionsByPeriod.
RetrieveTransactionsByPeriodThe list of valid options for the range of periods to retrieve transactions from when using a RetrieveTransactionsOption of RetrieveTransactionsByPeriod.
RetrieveTransactionsByMonthThe list of valid options for the range of months to retrieve transactions from when using a RetrieveTransactionsOption of RetrieveTransactionsByMonth.
PostingDateOptionThe list of valid options for the calculation of the posting date.
PeriodOptionThe list of valid options for how the transaction period will be calculated.
ScheduleExpiresOptionThe list of valid options for defining when the schedule will end.
Methods
getAllAllocationSchedulesglobal static List<c2g.AllocationScheduleService.AllocationSchedule> getAllAllocationSchedules() Return a list of all the allocation schedules. Use ManageAllocations (Manage Allocations) custom permission to grant permissions on this method. Return ValueThis service returns a list of c2g.AllocationScheduleService.AllocationSchedule objects. 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. List<c2g.AllocationScheduleService.AllocationSchedule> allocationSchedules = c2g.AllocationScheduleService.getAllAllocationSchedules(); getAllSchedulableTemplatesglobal static List<c2g.AllocationScheduleService.AllocationTemplate> getAllSchedulableTemplates() Returns all templates available for selection. A template is only available for selection if it has 100% of its total retrieve value distributed. All templates with a company the user has access to will be retrieved. If in single company mode, all companies created in single company mode will also be retrieved. Return ValueThis service returns a list of c2g.AllocationScheduleService.AllocationTemplate objects. 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. List<c2g.AllocationScheduleService.AllocationTemplate> templates = c2g.AllocationScheduleService.getAllSchedulableTemplates(); deleteAllocationSchedulesglobal static Set<Id> deleteAllocationSchedules(Set<Id> ids) Delete all the allocation schedules with the given ids. Use ManageAllocations (Manage Allocations) custom permission to grant permissions on this method. Input Parameters
Return ValueThis service returns a set of Id objects. 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. //Return a list of all the allocation schedules. List<c2g.AllocationScheduleService.AllocationSchedule> allocationSchedules = c2g.AllocationScheduleService.getAllAllocationSchedules(); //Create a list of ids of schedules we wish to delete Set<Id> schedulesToDelete = new Set<Id>{}; //In this example we are looping through all of the schedules to find one schedule we wish to delete by name for (c2g.AllocationScheduleService.AllocationSchedule allocationSchedule : allocationSchedules) { if (allocationSchedule.userDefinedName.equals('A schedule')) { schedulesToDelete.add(allocationSchedule.id); } } //Delete the schedule Set<Id> deletedIds = c2g.AllocationScheduleService.deleteAllocationSchedules(schedulesToDelete); saveglobal static Set<c2g.AllocationScheduleService.AllocationSchedule> save(Set<c2g.AllocationScheduleService.AllocationSchedule> dtos) Save the given allocation schedules. Active schedules will get scheduled. Each active schedule counts towards the Salesforce limit of scheduled Apex jobs. Use ManageAllocations (Manage Allocations) custom permission to grant permissions on this method. Input Parameters
Return ValueThis service returns a set of c2g.AllocationScheduleService.AllocationSchedule objects. 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. //Create a schedule using the methods of CronSpec c2g.CronSpec cron = c2g.CronSpec.createHourlyCron('1', '15'); //Get all the available AllocationTemplates List<c2g.AllocationScheduleService.AllocationTemplate> templates = c2g.AllocationScheduleService.getAllTemplates(); //Select your allocationScheduleTemplates (in this example we are simply selecting them all) List<c2g.AllocationScheduleService.AllocationScheduleTemplate> scheduleTemplates = new List<c2g.AllocationScheduleService.AllocationScheduleTemplate>(); for (Integer i=0; i<templates.size(); i++) { c2g.AllocationScheduleService.AllocationScheduleTemplate allocationScheduleTemplate = new c2g.AllocationScheduleService.AllocationScheduleTemplate(); allocationScheduleTemplate.allocationTemplate = templates[i]; allocationScheduleTemplate.sequence = i; scheduleTemplates.add(allocationScheduleTemplate); } //Create an AllocationSchedule c2g.AllocationScheduleService.AllocationSchedule allocationSchedule = new c2g.AllocationScheduleService.AllocationSchedule(); allocationSchedule.userDefinedName = 'A schedule'; allocationSchedule.description = 'My schedule description'; allocationSchedule.active = true; allocationSchedule.scheduleExpiresOption = c2g.AllocationScheduleService.ScheduleExpiresOption.After.name(); allocationSchedule.after = 12; allocationSchedule.retrieveTransactionsOption = c2g.AllocationScheduleService.RetrieveTransactionsOption.RetrieveTransactionsSpecificDates.name(); allocationSchedule.fromDate = Date.valueOf('2014-01-01 00:00:00'); allocationSchedule.toDate = Date.valueOf('2014-02-01 00:00:00'); allocationSchedule.transactionDescription = 'My transaction description'; allocationSchedule.postingDateOption = c2g.AllocationScheduleService.PostingDateOption.OffsetDate.name(); allocationSchedule.postingOffset = 0; allocationSchedule.periodOption = c2g.AllocationScheduleService.PeriodOption.RunDate.name(); allocationSchedule.allocationScheduleTemplates = scheduleTemplates; allocationSchedule.cron = cron; Set<c2g.AllocationScheduleService.AllocationSchedule> toSave = new Set<c2g.AllocationScheduleService.AllocationSchedule>{allocationSchedule}; Set<c2g.AllocationScheduleService.AllocationSchedule> savedSchedules = c2g.AllocationScheduleService.save(toSave); runNowglobal static Set<c2g.AllocationScheduleService.AllocationSchedule> runNow(Set<c2g.AllocationScheduleService.AllocationSchedule> dtos) Run the given allocation schedules now. Each active schedule counts towards the Salesforce limit of scheduled Apex jobs. Use ManageAllocations (Manage Allocations) custom permission to grant permissions on this method. Input Parameters
Return ValueThis service returns a set of c2g.AllocationScheduleService.AllocationSchedule objects. 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. //Get all the available AllocationTemplates List<c2g.AllocationScheduleService.AllocationTemplate> templates = c2g.AllocationScheduleService.getAllSchedulableTemplates(); //Select your allocationScheduleTemplates (in this example we are simply selecting them all) List<c2g.AllocationScheduleService.AllocationScheduleTemplate> scheduleTemplates = new List<c2g.AllocationScheduleService.AllocationScheduleTemplate>(); for (Integer i=0; i<templates.size(); i++) { c2g.AllocationScheduleService.AllocationScheduleTemplate allocationScheduleTemplate = new c2g.AllocationScheduleService.AllocationScheduleTemplate(); allocationScheduleTemplate.allocationTemplate = templates[i]; allocationScheduleTemplate.sequence = i; scheduleTemplates.add(allocationScheduleTemplate); } //Create an AllocationSchedule c2g.AllocationScheduleService.AllocationSchedule allocationSchedule = new c2g.AllocationScheduleService.AllocationSchedule(); allocationSchedule.userDefinedName = 'A schedule to run now'; allocationSchedule.description = 'My schedule description'; allocationSchedule.active = true; allocationSchedule.retrieveTransactionsOption = c2g.AllocationScheduleService.RetrieveTransactionsOption.RetrieveTransactionsSpecificDates.name(); allocationSchedule.fromDate = Date.valueOf( '2014-01-01 00:00:00'); allocationSchedule.toDate = Date.valueOf('2014-02-01 00:00:00'); allocationSchedule.transactionDescription = 'My transaction description'; allocationSchedule.postingDateOption = c2g.AllocationScheduleService.PostingDateOption.OffsetDate.name(); allocationSchedule.postingOffset = 0; allocationSchedule.periodOption = c2g.AllocationScheduleService.PeriodOption.RunDate.name(); allocationSchedule.allocationScheduleTemplates = scheduleTemplates; c2g.AllocationScheduleService.runNow(new Set<c2g.AllocationScheduleService.AllocationSchedule>{allocationSchedule}); c2g.AllocationScheduleService.AllocationScheduleglobal class AllocationSchedule this data type allows you to specify an allocation schedule. 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. c2g.AllocationScheduleService.AllocationSchedule allocationSchedule = new c2g.AllocationScheduleService.AllocationSchedule(); allocationSchedule.userDefinedName = 'A schedule'; allocationSchedule.description = 'My schedule description'; allocationSchedule.active = true; allocationSchedule.scheduleExpiresOption = c2g.AllocationScheduleService.ScheduleExpiresOption.After.name(); allocationSchedule.after = 12; allocationSchedule.retrieveTransactionsOption = c2g.AllocationScheduleService.RetrieveTransactionsOption.RetrieveTransactionsSpecificDates.name(); allocationSchedule.fromDate = Date.valueOf('2014-01-01 00:00:00'); allocationSchedule.toDate = Date.valueOf('2014-02-01 00:00:00'); allocationSchedule.transactionDescription = 'My transaction description'; allocationSchedule.postingDateOption = c2g.AllocationScheduleService.PostingDateOption.OffsetDate.name(); allocationSchedule.postingOffset = 0; allocationSchedule.periodOption = c2g.AllocationScheduleService.PeriodOption.RunDate.name(); allocationSchedule.allocationScheduleTemplates = scheduleTemplates; allocationSchedule.cron = cron; Properties
c2g.AllocationScheduleService.AllocationScheduleTemplateglobal class AllocationScheduleTemplate this data type allows you to specify an allocation schedule template. a list of allocation schedule templates will be held by every allocation schedule. an allocation schedule template is simply an allocation template with a sequence number. 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. c2g.AllocationScheduleService.AllocationScheduleTemplate allocationScheduleTemplate = new c2g.AllocationScheduleService.AllocationScheduleTemplate(); allocationScheduleTemplate.allocationTemplate = myTemplate; allocationScheduleTemplate.sequence = 1; Properties
c2g.AllocationScheduleService.AllocationTemplateglobal class AllocationTemplate this data type represents an allocation template. an allocation template will be held on every allocation schedule template. an allocation schedule template simply holds the id of an allocation template and its name. a list of all available allocation templates can be retrieved via allocationscheduleservice.getallschedulabletemplates. 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. List<c2g.AllocationScheduleService.AllocationTemplate> templates = c2g.AllocationScheduleService.getAllSchedulableTemplates(); Properties
|