A new custom callback class is supported to calculate and set the allocated revenue amount for each Agreement Line Item. 

It allocates performance obligations for a set of Agreement Line Items. For each performance obligation, it calculates Allocated Amount and Transaction Price.

To add the custom class

  1. Go to Setup > App Setup > Develop > Apex Classes.
  2. Click New.
  3. Enter the sample callback class code.


This is just a sample callback class to allocate performance obligations. You may change the code as per your requirements.

global interface IRevenueAllocation
	{
		/**
		 * Calculate the allocated revenue amount for each Agreement Line Item
		 * and update the "Allocation Amount" on each Agreement Line Item
		 * accordingly. There is no need to call "Upsert" as that will performed by
		 * the Revenue Configuration/Integration package.
		 *
		 * Upon return, the sum of the Transaction Price fields of the Agreement
		 * Line Items must match the sum of the Allocation Amount fields. If that
		 * is not the case, the Revenue Integration/Configuration package will throw
		 * an Exception. 
		 *
		 * @param agreementLineItms The list of Agreement Line Items the dependent 
		 *   charges pertain to. It is expected the Allocation Amount on each 
		 *   Agreement Line Item will be updated accordingly.
		 * @param agreemnt The corresponding Agreement.
		 */
		void calculateAllocationAmount(
			List<Apttus__AgreementLineItem__c> agreementLineItems,
			Apttus__APTS_Agreement__c agreemnt);
	}
public with sharing class TestRevenueAllocationCallback 
	implements CustomClass.IRevenueAllocation {
	
	@TestVisible private static Boolean specialUsecase = false;
	
	public void calculateAllocationAmount(List<Apttus__AgreementLineItem__c> agreementLineItems,
										  Apttus__APTS_Agreement__c agreemnt) {
										  	
		//get sum of all LineItems having MEA flat to true
		Decimal totalTransactionPrice = 0.0;
		Decimal totalNetPrice = 0.0;
			
		//initialise variables to Allocate proper value to all LineItems
		Integer iCount = 0;
		Decimal totalRemainingTransactionPrice = 0;
		for(Apttus__AgreementLineItem__c lineItemSO :agreementLineItems) {
			totalRemainingTransactionPrice += lineItemSO.TransactionPrice__c;
			totalTransactionPrice += lineItemSO.TransactionPrice__c;
			totalNetPrice += lineItemSO.Apttus__NetPrice__c;
			iCount++;
		}
			
		//calculate Allocation Amount for each LineItem
		for(Apttus__AgreementLineItem__c lineItemSO :agreementLineItems) {
			if(specialUsecase) {
				lineItemSO.AllocationAmount__c = 10;
				continue;
			}
			if(iCount == 1) {
				lineItemSO.AllocationAmount__c = totalRemainingTransactionPrice; 
			} else {
				lineItemSO.AllocationAmount__c = ((lineItemSO.TransactionPrice__c / totalTransactionPrice) * totalNetPrice).setScale(RuntimeContext.DEFAULT_SCALE);
			}
			totalRemainingTransactionPrice -= lineItemSO.AllocationAmount__c; 
			iCount--;
			
		}
		
	}

}
CODE


4. Click Save.


To register your custom callback class, go to Setup > App Setup > Develop > Custom Settings and click Manage beside Revenue System Properties. Click Edit for System Properties and enter the name of your custom callback class in Revenue Allocation Callback.

Refer to Revenue System Properties for more details.