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 with sharing 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 with sharing 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 with sharing 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
|