(PSX) Budget ExtensionLearn how you can extend Precursive core budget functionality with your custom code.03-Mar-2025Knowledge
InformationTitle(PSX) Budget ExtensionURL NameBudget-ExtensionBodyAbout This functionality allows extending the out of the box Precursive Budget Recalculation batch with a custom implementation using our interface. This could include custom fields to be recalculated in the out of the box Budget Calculation batch or after it finishes. An example of that can be a numeric custom field on the Phase that can be summed up on the Project level. Setup This Interface needs to be implemented within a custom apex class: global interface IBudgetExtension { void extendSynchronousBudgetCalculation(Id projectId); void extendAsynchronousBudgetCalculationViaBatchFinishMethod( Database.BatchableContext BC, Set<Id> projectsIds);}After implementing your custom code, your class needs to be added to the Custom Setting >> Precursive Implementation Settings into the Budget Extension Class Name field. In your custom apex class you need to implement both methods from the interface. However, you can define only one place when that method should be triggered. In that case, you need to add the logic only to one method and leave another one blank. If your custom calculation includes our core calculations, we recommend using the second method so calculate your numbers in the batch that starts after the core Budget Recalculation is finished. Apex class example of using our interface: global class ExtendedBudget implements IBudgetExtension { // This method will be executed synchronously to our core calculations when: 1) project detail page is loading, 2) batch’s execute method is processing public void extendSynchronousBudgetCalculation(Id projectId){ // your logic here } // This method will be executed during asynchronous budget recalculations as post-processing operation in batch’s finish method public void extendAsynchronousBudgetCalculationViaBatchFinishMethod( Database.BatchableContext BC, Set<Id> projectsIds){ // your logic here }}Important note: your custom apex class has to have global access modifier defined.
Was this article helpful?Choose a general reason-- Choose a general reason --FeedbackUpload FilesUpload FilesOr drop filesSubmit