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.

Enums

ActualsProcessType

Value Description
ACTUALS_VERIFIER Represents the actuals verifier process.
PROJECT_ACTUALS_RECALCULATION Represents the project actuals recalculation process.
RESOURCE_ACTUALS_RECALCULATION Represents the resource actuals recalculation process.
RPG_ACTUALS_RECALCULATION Represents the region, practice, or group actuals recalculation process.
HIERARCHY_CHANGE_ACTUALS_RECALCULATION Represents the hierarchy-change-driven actuals recalculation process.

Methods

processTransactionDeltas

global static pse.APICommonsService.BatchStatus processTransactionDeltas()

Immediately starts the job to process transaction deltas. If the job is set to continuous mode it will return null. 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 if using batch, 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

getActualsAppLogs

global static List<appirio_core__App_Log__c> getActualsAppLogs(pse.AppLogQueryContext queryContext)

Returns app logs that are related to actuals calculations, filtered by the provided query context.

Input Parameters

Name Type Description
queryContext pse.AppLogQueryContext A structure containing the query parameters.

Return Value

A list of App Log records matching the criteria.

getActualsLockStatus

global static pse.APIActualsService.ActualsLockStatus getActualsLockStatus()

Returns the current lock status of actuals process, including the name of the process holding the lock. When actuals are unlocked, the lockSource property is null.

Return Value

An ActualsLockStatus object containing whether actuals are locked and the name of the locking process.

getRecalculationStatus

global static pse.APIActualsService.RecalculationStatus getRecalculationStatus()

Returns the status and types of actuals recalculation processes. This includes UI-driven recalculation (Actuals Verifier, Project Actuals Recalculation, Resource Actuals Recalculation, RPG Actuals Recalculation) and hierarchy-change recalculation.

Return Value

A RecalculationStatus object containing whether recalculation is in progress and the types of recalculation.

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.

pse.APIActualsService.ActualsLockStatus

global with sharing class ActualsLockStatus

Stores the current lock status of actuals process.

Properties

Name Type Description
isLocked Boolean Indicates whether actuals process is currently locked.
lockSource pse.APIActualsService.ActualsProcessType Identifies the process that currently holds the actuals lock, or null if actuals are unlocked.

pse.APIActualsService.RecalculationStatus

global with sharing class RecalculationStatus

Represents the status and types of actuals recalculation processes.

Properties

Name Type Description
isInProgress Boolean Indicates whether recalculation is currently in progress.
recalculationTypes List<pse.APIActualsService.ActualsProcessType> Identifies the types of recalculation processes that are currently running, or an empty list if no recalculation is in progress.
© Copyright 2009–2026 Certinia Inc. All rights reserved. Various trademarks held by their respective owners.