Professional Services Automation Apex API Developer Reference

pse.APIActualsService

global with sharing class APIActualsService

This class contains methods and structures that can be used to automate processes surrounding actuals calculations.

Methods

processTransactionDeltas

global static pse.APICommonsService.BatchStatus processTransactionDeltas()

Immediately starts the batch job to process transaction deltas. The status property of the return object is 'Batched' if the job is started successfully, or 'Error' if the job failed.

Return Value

This service returns an APICommonsService.BatchStatus object that contains the Id of the new job, which you can query to monitor its progress.

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.

pse.APICommonsService.BatchStatus bs = pse.ProcessTransactionDeltas();

if (bs.status == 'Error') {
    System.debug('Oh no! ' + bs.errorMessage);
    return;
}

//Wait a bit...

AsyncApexJob job = [SELECT Id, Status FROM AsyncApexJob WHERE Id =: bs.jobID];
System.debug('Status: ' + job.Status);

recalcProjectActualsByProjects

global static pse.APICommonsService.BatchStatus recalcProjectActualsByProjects(pse.APIActualsService.ActualsContextRecalcProjectActualsByProjects actualsContext)

Recalculates project actuals for the specified projects. This process has several chained steps that begin after the current Apex transaction completes.

  1. A batch job is started to delete the Project Actuals records for the supplied projects. When it starts, this job locks actuals. Locking actuals prevents multiple jobs running concurrently, which can cuase errors.
  2. When the Project Actuals records are deleted, a new batch job is started to delete Project Actuals Converted records.
  3. When the Project Actuals Converted records are deleted, another batch job recalculates the Project Actuals records for the supplied projects.
  4. When recalculated Project Actuals records have been created, actuals are unlocked.

Input Parameters

Name Type Description
actualsContext pse.APIActualsService.ActualsContextRecalcProjectActualsByProjects A structure containing the projects to recalculate actuals for.

Return Value

See APICommonsService.BatchStatus for how to check the result of the call.

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<pse__Proj__c> projectsToRecalculate = [SELECT Id FROM pse__Proj__c WHERE pse__Region__r.Name = 'Spain' AND pse__Stage__c = 'In Progress'];
Set<Id> targetIds = new Set<Id>();
for (pse__Proj__c proj : projectsToRecalculate) {
    targetIds.add(proj.Id);
}
//Prepare param
pse.APIActualsService.ActualsContextRecalcProjectActualsByProjects actualsContext = new pse.APIActualsService.ActualsContextRecalcProjectActualsByProjects();
actualsContext.projectIds = targetIds;

//Call service
pse.APICommonsService.BatchStatus bs = pse.APIActualsService.recalcProjectActualsByProjects(actualsContext);

recalcProjectActualsWithActualsNeedsRecalc

global static pse.APICommonsService.BatchStatus recalcProjectActualsWithActualsNeedsRecalc(pse.APIActualsService.ActualsContextRecalcProjectActualsWithActualsNeedsRecalc actualsContext)

Recalculates project actuals on projects where the Actuals: Needs Recalc checkbox is selected. The parameter can further restrict the project actuals to be recalculated. The process steps are identical to recalcProjectActualsByProjects. See that method for details.

Input Parameters

Name Type Description
actualsContext pse.APIActualsService.ActualsContextRecalcProjectActualsWithActualsNeedsRecalc A structure containing the Ids of regions, practices, groups, and accounts for which to recalculate project actuals, where the Actuals Needs Recalc checkbox is selected.

Return Value

See APICommonsService.BatchStatus for how to check the result of the call.

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.

You need to provide some sample code

pse.APIActualsService.ActualsContextRecalcProjectActualsByProjects

global inherited sharing class ActualsContextRecalcProjectActualsByProjects extends APICommonsService.BatchContext

A structure containing the projects to recalculate actuals for. Used as the parameter for RecalcProjectActualsByProjects.

This class extends pse.APICommonsService.BatchContext

Properties

Name Type Description
projectIds Set<Id> Ids of the projects to filter actuals data for.

pse.APIActualsService.ActualsContextRecalcProjectActualsWithActualsNeedsRecalc

global inherited sharing class ActualsContextRecalcProjectActualsWithActualsNeedsRecalc extends APICommonsService.BatchContext

A structure containing the Ids of regions, practices, groups and accounts to recalculate project actuals for, where the Actuals Needs Recalc checkbox is selected.

This class extends pse.APICommonsService.BatchContext

Properties

Name Type Description
regionId Id Id of the region that contains the projects for which the actuals are to be recalculated. May be null if there is no restriction on region.
practiceId Id Id of the practice that contains the projects for which the actuals are to be recalculated. May be null if there is no restriction on practice.
groupId Id Id of the group that contains the projects for which the actuals are to be recalculated. May be null if there is no restriction on group.
accountId Id Id of the account on which that contains the projects for which the actuals are to be recalculated. May be null if there is no restriction on account.
© Copyright 2009–2023 Certinia Inc. All rights reserved. Various trademarks held by their respective owners.