pse.MilestoneServiceglobal with sharing class MilestoneService Service providing functionality relating to Milestones. This class contains deprecated items. Methods
updateExpenseRollupsglobal static Id updateExpenseRollups(Set<Id> milestoneIds) Recalculates fields on Milestone whose values are calculated from Expenses linked to the Milestone. This version will execute synchronously, but may fail with large volumes of data. If the calculation needs to handle large numbers of expenses or milestones, call MilestoneService.updateExpenseRollupsAsync(Set<Id> milestoneIds) instead.
Input Parameters
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.
//Recalculate all Expense data on all milestones on the 'Small Project' project. This is known to be a small project with only a few milestones and expenses, so synchronous processing is appropriate.
List<pse__Milestone__c> milestones = [SELECT Id FROM pse__Milestone__c WHERE pse__Project__r.Name = 'Small Project'];
Set<Id> milestonesToRecalculate = new Set<Id>();
for (pse__Milestone__c ms : milestones)
{
milestonesToRecalculate.add(ms.Id);
}
pse.MilestoneService.updateExpenseRollups(milestonesToRecalculate);
updateTimecardRollupsglobal static Id updateTimecardRollups(Set<Id> milestoneIds) Recalculates fields on Milestone whose values are calculated from Timecards linked to the Milestone. This version will execute synchronously, but may fail with large volumes of data. If the calculation needs to handle large numbers of timecards or milestones, call MilestoneService.updateTimecardRollupsAsync(Set<Id> milestoneIds) instead.
Input Parameters
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.
//Recalculate all Timecard data on all milestones on the 'Small Project' project. This is known to be a small project with only a few milestones and timecards, so synchronous processing is appropriate.
List<pse__Milestone__c> milestones = [SELECT Id FROM pse__Milestone__c WHERE pse__Project__r.Name = 'Small Project'];
Set<Id> milestonesToRecalculate = new Set<Id>();
for (pse__Milestone__c ms : milestones)
{
milestonesToRecalculate.add(ms.Id);
}
pse.MilestoneService.updateTimecardRollups(milestonesToRecalculate);
updateExpenseRollupsAsyncAPIglobal static Id updateExpenseRollupsAsyncAPI(Set<Id> milestoneIds) Recalculates fields on Milestone whose values are calculated from Expenses linked to the Milestone. This version may run asynchronously to handle large volumes of data. If you want the calculation performed immediately, call MilestoneService.updateExpenseRollups(Set<Id> milestoneIds) instead.
Input Parameters
Return ValueThe Id of the AsyncJobRecord that performs the calculation. Note this job may create other async job records. So the rollup process might run for some time after the job in the return value has completed. 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.
//Recalculate all Expense data on all milestones on the 'Large Project' project. We know this is a large project with lots of milestones and expenses, so asynchronous processing is required.
List<pse_Milestone__c> milestones = [SELECT Id FROM pse_Milestone__c WHERE pse__Project__r.Name = 'Large Project'];
Set<Id> milestonesToRecalculate = new Set<Id>();
for (pse__Milestone__c ms : milestones)
{
milestonesToRecalculate.add(ms.Id);
}
Id asyncJobRecodId = pse.MilestoneService.updateExpenseRollupsAsyncAPI(milestonesToRecalculate);
updateTimecardRollupsAsyncAPIglobal static Id updateTimecardRollupsAsyncAPI(Set<Id> milestoneIds) Recalculates fields on Milestone whose values are calculated from Timecards linked to the milestone. This version may run asynchronously to handle large volumes of data. If you want the calculation performed immediately, call MilestoneService.updateTimecardRollupsEnqueuer(Set<Id> milestoneIds) instead.
Input Parameters
Return ValueThe Id of the ApexAsyncJob that performs the calculation. Note this job may create other async jobs. So the rollup process might run for some time after the job in the return value has completed. 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.
//Recalculate all Timecard data on all milestones on the 'Large Project' project. We know this is a large project with lots of milestones and timecards, so asynchronous processing is required.
List<pse__Milestone__c> milestones = [SELECT Id FROM pse__Milestone__c WHERE pse__Project__r.Name = 'Large Project'];
Set<Id> milestonesToRecalculate = new Set<Id>();
for (pse__Milestone__c ms : milestones)
{
milestonesToRecalculate.add(ms.Id);
}
Id asyncJobRecodId = pse.MilestoneService.updateTimecardRollupsAsyncAPI(milestonesToRecalculate);
DeprecatedThe following items are deprecated and not supported for use. We recommend that you stop using these items to avoid exceptions. Methods
updateExpenseRollupsAsyncDeprecated: We have deprecated the updateExpenseRollupsAsync method originally intended for recalculating fields on Milestones whose values are calculated from Expenses linked to the milestone. It is now replaced with updateExpenseRollupsAsyncAPI. We recommend you do not use this method as it will be removed in a future release. global static Id updateExpenseRollupsAsync(Set<Id> milestoneIds) Recalculates fields on Milestone whose values are calculated from Expenses linked to the Milestone. This version may run asynchronously to handle large volumes of data. If you want the calculation performed immediately, call MilestoneService.updateExpenseRollups(Set<Id> milestoneIds) instead.
Input Parameters
Return ValueThe Id of the ApexAsyncJob that performs the calculation. Note this job may create other async jobs. So the rollup process might run for some time after the job in the return value has completed. 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.
//Recalculate all Expense data on all milestones on the 'Large Project' project. We know this is a large project with lots of milestones and expenses, so asynchronous processing is required.
List<pse_Milestone__c> milestones = [SELECT Id FROM pse_Milestone__c WHERE pse__Project__r.Name = 'Large'];
Set<Id> milestonesToRecalculate = new Set<Id>();
for (pse_Milestone__c ms : milestones)
{
milestonesToRecalculate.add(ms.Id);
}
Id jobId = pse.MilestoneService.updateExpenseRollupsAsync(milestonesToRecalculate);
updateTimecardRollupsAsyncDeprecated: We have deprecated the updateTimecardRollupsAsync method originally intended for recalculating fields on Milestones whose values are calculated from Timecards linked to the milestone. It is now replaced with updateTimecardRollupsAsyncAPI. We recommend you do not use this method as it will be removed in a future release. global static Id updateTimecardRollupsAsync(Set<Id> milestoneIds) Recalculates fields on Milestone whose values are calculated from Timecards linked to the Milestone. This version may run asynchronously to handle large volumes of data. If you want the calculation performed immediately, call MilestoneService.updateTimecardRollups(Set<Id> milestoneIds) instead.
Input Parameters
Return ValueThe Id of the ApexAsyncJob that performs the calculation. Note this job may create other async jobs. So the rollup process might run for some time after the job in the return value has completed. 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.
//Recalculate all Timecard data on all milestones on the 'Large Project' project. We know this is a large project with lots of milestones and timecards, so asynchronous processing is required.
List<pse_Milestone__c> milestones = [SELECT Id FROM pse_Milestone__c WHERE pse__Project__r.Name = 'Large Project'];
Set<Id> milestonesToRecalculate = new Set<Id>();
for (pse_Milestone__c ms : milestones)
{
milestonesToRecalculate.add(ms.Id);
}
Id jobId = pse.MilestoneService.updateTimecardRollupsAsync(milestonesToRecalculate);
|