pse.AssignmentServiceglobal with sharing class AssignmentService Service providing functionality relating to Assignments. This class contains deprecated items. Methods
updateTimecardRollupsglobal static void updateTimecardRollups(Set<Id> assignmentIds) Recalculates fields on Assignment whose values are calculated from Timecards linked to the assignment. This version will execute synchronously, but may fail with large volumes of data. If the calculation needs to handle large numbers of timecards or assignments, call AssignmentService.updateTimecardRollupsAsync(Set<Id> assignmentIds) 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 assignments on the 'Proyecto Pequeno' project.
List<pse__Assignment__c> assignments = [SELECT Id FROM pse__Assignment__c WHERE pse__Project__r.Name = 'Proyecto Pequeno'];
Set<Id> assignmentsToRecalculate = new Set<Id>();
for (pse__Assignment__c asmt : assignments)
{
assignmentsToRecalculate.add(asmt.Id);
}
pse.AssignmentService.updateTimecardRollups(assignmentsToRecalculate);
updateExpenseRollupsglobal static void updateExpenseRollups(Set<Id> assignmentIds) Recalculates fields on Assignment whose values are calculated from Expenses linked to the assignment. This version will execute synchronously, but may fail with large volumes of data. If the calculation needs to handle large numbers of expenses or assignments, call AssignmentService.updateExpenseRollupsAsync(Set<Id> assignmentIds) 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 assignments on the 'Proyecto Pequeno' project.
List<pse__Assignment__c> assignments = [SELECT Id FROM pse__Assignment__c WHERE pse__Project__r.Name = 'Proyecto Pequeno'];
Set<Id> assignmentsToRecalculate = new Set<Id>();
for (pse__Assignment__c asmt : assignments)
{
assignmentsToRecalculate.add(asmt.Id);
}
pse.AssignmentService.updateExpenseRollups(assignmentsToRecalculate);
updateExpenseRollupsAsyncAPIglobal static Id updateExpenseRollupsAsyncAPI(Set<Id> assignmentIds) Recalculates fields on Assignment whose values are calculated from Expenses linked to the assignment. This version may run asynchronously to handle large volumes of data. If you want the calculation performed immediately, call AssignmentService.updateExpenseRollups(Set<Id> assignmentIds) 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 assignments on the 'Proyecto Pequeno' project.
List<pse__Assignment__c> assignments = [SELECT Id FROM pse__Assignment__c WHERE pse__Project__r.Name = 'Proyecto Pequeno'];
Set<Id> assignmentsToRecalculate = new Set<Id>();
for (pse__Assignment__c asmt : assignments)
{
assignmentsToRecalculate.add(asmt.Id);
}
Id asyncJobRecodId = pse.AssignmentService.updateExpenseRollupsAsyncAPI(assignmentsToRecalculate);
updateTimecardRollupsAsyncAPIglobal static Id updateTimecardRollupsAsyncAPI(Set<Id> assignmentIds) Recalculates fields on Assignment whose values are calculated from Timecards linked to the assignment. This version may run asynchronously to handle large volumes of data. If you want the calculation performed immediately, call AssignmentService.updateTimecardRollupsEnqueuer(Set<Id> assignmentIds) 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 assignments on the 'Proyecto Pequeno' project.
List<pse__Assignment__c> assignments = [SELECT Id FROM pse__Assignment__c WHERE pse__Project__r.Name = 'Proyecto Pequeno'];
Set<Id> assignmentsToRecalculate = new Set<Id>();
for (pse__Assignment__c asmt : assignments)
{
assignmentsToRecalculate.add(asmt.Id);
}
Id asyncJobRecodId = pse.AssignmentService.updateTimecardRollupsAsyncAPI(assignmentsToRecalculate);
DeprecatedThe following items are deprecated and not supported for use. We recommend that you stop using these items to avoid exceptions. Methods
updateTimecardRollupsAsyncDeprecated: We have deprecated the updateTimecardRollupsAsync method originally intended for recalculating fields on Assignments whose values are calculated from Timecards linked to the assignment. 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> assignmentIds) Recalculates fields on Assignment whose values are calculated from Timecards linked to the assignment. This version may run asynchronously to handle large volumes of data. If you want the calculation performed immediately, call AssignmentService.updateTimecardRollups(Set<Id> assignmentIds) instead. The fields that will be updated are:
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 assignments on the 'Consulting 2017' project.
List<pse__Assignment__c> assignments = [SELECT Id FROM pse__Assignment__c WHERE pse__Project__r.Name = 'Consulting 2017'];
Set<Id> assignmentsToRecalculate = new Set<Id>();
for (pse__Assignment__c asmt : assignments)
{
assignmentsToRecalculate.add(asmt.Id);
}
Id jobId = pse.AssignmentService.updateTimecardRollupsAsync(assignmentsToRecalculate);
updateExpenseRollupsAsyncDeprecated: We have deprecated the updateExpenseRollupsAsync method originally intended for recalculate the expense rollup fields. 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> assignmentIds) Recalculates fields on Assignment whose values are calculated from Expenses linked to the assignment. This version may run asynchronously to handle large volumes of data. If you want the calculation performed immediately, call AssignmentService.updateExpenseRollups(Set<Id> assignmentIds) 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 assignments on the 'Consulting 2017' project.
List<pse__Assignment__c> assignments = [SELECT Id FROM pse__Assignment__c WHERE pse__Project__r.Name = 'Consulting 2017'];
Set<Id> assignmentsToRecalculate = new Set<Id>();
for (pse__Assignment__c asmt : assignments)
{
assignmentsToRecalculate.add(asmt.Id);
}
Id jobId = pse.AssignmentService.updateExpenseRollupsAsync(assignmentsToRecalculate);
|