Using the Revenue Recognition Service With Process Builders

Process builders provide a convenient way to call the revenue recognition service. After you’ve defined your Revenue Recognition class, your process builder can call the service while passing it key revenue information from the object where you want to recognize revenue.

When you use a process builder to trigger the revenue recognition process, configure your conditions carefully so you don’t accidentally create multiple revenue schedules at once for the same record. For example, if you want to recognize revenue when a contract’s status changes to Activated and your trigger condition checks only that the payment’s status equals Posted, any value change on an activated contract will trigger your process. Instead, use conditions that trigger the process only when a contract’s status changes to Activated.

Your process builder calls the blng.recognizeRevenue APEX method, which accepts the input parameters defined in Revenue Recognition Service Developer Guide. Take Remember, your RevenueRecognitionInputs class must at least define a Revenue Amount, Revenue Recognition Rule ID, Start Date, ID Source, and Source Field name. Your builder’s Apex variables have to pass at least these five variables to successfully invoke the Revenue Recognition class, and any optional variables that you need.

We recommend defining Apex variables that inherit the value of an equivalent field. When you map a field in the process builder, we recommend using a formula field such as VALUE(TEXT(Object.[Field])). Here are a few examples.

Currently, currency fields aren’t supported as invocable variables, so we use decimals to define the revenueAmount.

Note

ObjectApex Variable TypeObject FieldApex Variable Value
Quote LineFormulaSBQQ__ListTotal__cVALUE(Text([SBQQ__QuoteLine__c].SBQQ__ListTotal__c
OrderFormulaTotalPriceVALUE(Text([OrderItem].TotalPrice))
ContractFormulaAmountVALUE(Text(Contract__c.Amount))

Here are a few ways you can define a value for Start Date.

ObjectApex Variable TypeObject FieldApex Variable Value
Quote LineDateSBQQ__Start__Date__c[SBQQ__QuoteLine__c].SBQQ__StartDate__c
OrderDateEffective-Date[OrderItem].Order.Effective-Date
ContractDateActivatedDateContract.ActivatedDate

Example 

In this example, we want a process builder that recognizes quote line revenue after a quote is approved.

Criteria: Executes when any of the conditions are met.

Conditions

FieldOperatorTypePicklist
[SBQQ__QuoteLine__c].SBQQ__Quote__r.SBQQ__Status__cEqualsPicklistApproved

APEX Variables

Apex Class: Recognize Revenue

FieldTypeValue
startDateDate[SBQQ__QuoteLine__c].SBQQ__StartDate__c
sourceFieldNameStringSBQQ__Quote__Line__c
sourceField Reference[SBQQ__QuoteLine__c].Id
revenueAmountFormulaVALUE(Text([SBQQ__QuoteLine__c].SBQQ__ListTotal__c))
revenueRecognitionRuleIdField Reference[SBQQ__QuoteLine__c].SBQQ__Product__r.blng__RevenueRecognitionRule__r.Id
endDateDate[SBQQ__QuoteLine__c].SBQQ__EndDate__c
LegalEntityIDField Reference[SBQQ__QuoteLine__c].LegalEntity__c
Use a custom quote line field called Legal Entity that looks up to the same legal entity that you plan to use for your order product.

Example 

In this example, we want a process builder that forecasts revenue when a contract is activated. We’ve defined a custom blng__Contract__c field on the revenue schedule to store the contract’s ID value for sourceFieldName. Instead of using a variable from the source entity for our end date, we’ve defined a static date.

Criteria: Executes when all of the conditions are met.

Conditions

FieldOperatorTypePicklist
ContractIs changedBooleanTrue
ContractEqualsPicklistPosted

APEX Variables

Apex Class: Recognize Revenue

FieldTypeValue
startDateDateContract.ActivatedDate
sourceFieldNameStringblng__Contract__c
sourceField ReferenceContract.Id
revenueAmountFormulaVALUE(Text(Contract.blng__Amount__c))
revenueRecognitionRuleIdField Reference[SBQQ__QuoteLine__c].SBQQ__Product__r.blng__RevenueRecognitionRule__r.Id
endDateDate12/31/2019

Example 

In this example, we want a process builder that forecasts order product revenue after an order product is activated.

Criteria: Executes when all of the conditions are met.

Conditions

FieldOperatorTypePicklist
[OrderItem].SBQQ__Status__cIs changedBooleanTrue
[OrderItem].SBQQ__Status__cEqualsPicklistActivated

APEX Variables

Apex Class: Recognize Revenue

FieldTypeValue
startDateDate[OrderItem].Order.Effective-Date
sourceFieldNameStringblng__OrderProduct__c
sourceField Reference[OrderItem].Id
revenueAmountFormula[OrderItem].Id
revenueRecognitionRuleIdField Reference[OrderItem].Product2.blng_Revenue_Recognition_Rule__r.Id
endDateDate[OrderItem].Order.EndDate