Service providing functionality relating to Assignments.
updateTimecardRollupsAsync
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:
- pse__Billable_Amount_In_Financials__c
- pse__Billable_Amount_Submitted__c
- pse__Billable_Days_In_Financials__c
- pse__Billable_Days_Submitted__c
- pse__Billable_Hours_In_Financials__c
- pse__Billable_Hours_Submitted__c
- pse__Non_Billable_Days_In_Financials__c
- pse__Non_Billable_Days_Submitted__c
- pse__Non_Billable_Hours_In_Financials__c
- pse__Non_Billable_Hours_Submitted__c
- pse__Timecard_External_Costs_In_Financials__c
- pse__Timecard_External_Costs_Submitted__c
- pse__Timecard_Internal_Costs_In_Financials__c
- pse__Timecard_Internal_Costs_Submitted__c
Note that PSA's triggers will keep these fields up to date. However it may be necessary to call this method to correct data in some situations, for example when an assignment is closed.
Input Parameters
assignmentIds |
Set<Id> |
The assignments on which to recalculate the timecard rollup fields. |
Return Value
The 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
1 2 3 4 5 6 7 8 9 10 11 12 13 | 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);
|
updateTimecardRollups
global 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.
The fields that will be updated are:
- pse__Billable_Amount_In_Financials__c
- pse__Billable_Amount_Submitted__c
- pse__Billable_Days_In_Financials__c
- pse__Billable_Days_Submitted__c
- pse__Billable_Hours_In_Financials__c
- pse__Billable_Hours_Submitted__c
- pse__Non_Billable_Days_In_Financials__c
- pse__Non_Billable_Days_Submitted__c
- pse__Non_Billable_Hours_In_Financials__c
- pse__Non_Billable_Hours_Submitted__c
- pse__Timecard_External_Costs_In_Financials__c
- pse__Timecard_External_Costs_Submitted__c
- pse__Timecard_Internal_Costs_In_Financials__c
- pse__Timecard_Internal_Costs_Submitted__c
Note that PSA's triggers will keep these fields up to date. However it may be necessary to call this method to correct data in some situations, for example when an assignment is closed.
Input Parameters
assignmentIds |
Set<Id> |
The assignments on which to recalculate the timecard rollup fields. |
Sample Code
1 2 3 4 5 6 7 8 9 10 11 12 13 | 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);
|
updateExpenseRollups
global 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.
The fields that will be updated are:
- pse__Billable_Expenses_In_Financials__c
- pse__Billable_Expenses_Submitted__c
- pse__Non_Billable_Expenses_In_Financials__c
- pse__Non_Billable_Expenses_Submitted__c
Note that PSA's triggers will keep these fields up to date. However it may be necessary to call this method to correct data in some situations, for example when an assignment is closed.
Input Parameters
assignmentIds |
Set<Id> |
The assignments on which to recalculate the expense rollup fields. |
Sample Code
1 2 3 4 5 6 7 8 9 10 11 12 13 | 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);
|
updateExpenseRollupsAsyncAPI
global 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.
The fields that will be updated are:
- pse__Billable_Expenses_In_Financials__c
- pse__Billable_Expenses_Submitted__c
- pse__Non_Billable_Expenses_In_Financials__c
- pse__Non_Billable_Expenses_Submitted__c
Note that PSA's triggers will keep these fields up to date. However it may be necessary to call this method to correct data in some situations, for example when an assignment is closed.
Input Parameters
assignmentIds |
Set<Id> |
The assignments on which to recalculate the expense rollup fields. |
Return Value
The 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
1 2 3 4 5 | You need to provide some sample code
|
updateTimecardRollupsAsyncAPI
global 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.
The fields that will be updated are:
- pse__Billable_Amount_In_Financials__c
- pse__Billable_Amount_Submitted__c
- pse__Billable_Days_In_Financials__c
- pse__Billable_Days_Submitted__c
- pse__Billable_Hours_In_Financials__c
- pse__Billable_Hours_Submitted__c
- pse__Non_Billable_Days_In_Financials__c
- pse__Non_Billable_Days_Submitted__c
- pse__Non_Billable_Hours_In_Financials__c
- pse__Non_Billable_Hours_Submitted__c
- pse__Timecard_External_Costs_In_Financials__c
- pse__Timecard_External_Costs_Submitted__c
- pse__Timecard_Internal_Costs_In_Financials__c
- pse__Timecard_Internal_Costs_Submitted__c
Note that PSA's triggers will keep these fields up to date. However it may be necessary to call this method to correct data in some situations, for example when an assignment is closed.
Input Parameters
assignmentIds |
Set<Id> |
The assignments on which to recalculate the timecard rollup fields. |
Return Value
The 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
1 2 3 4 5 | You need to provide some sample code
|
The following items are deprecated and not supported for use. We recommend that you stop using these items to avoid exceptions.
updateExpenseRollupsAsync
Deprecated: Use updateExpenseRollupsAsyncAPI(Set assignmentIds) instead.
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.
The fields that will be updated are:
- pse__Billable_Expenses_In_Financials__c
- pse__Billable_Expenses_Submitted__c
- pse__Non_Billable_Expenses_In_Financials__c
- pse__Non_Billable_Expenses_Submitted__c
Note that PSA's triggers will keep these fields up to date. However it may be necessary to call this method to correct data in some situations, for example when an assignment is closed.
Input Parameters
assignmentIds |
Set<Id> |
The assignments on which to recalculate the expense rollup fields. |
Return Value
The 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
1 2 3 4 5 6 7 8 9 10 11 12 13 | 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);
|