Newer Version Available
Using the Revenue Recognition Service With Process Builders
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.
| Object | Apex Variable Type | Object Field | Apex Variable Value |
|---|---|---|---|
| Quote Line | Formula | SBQQ__ListTotal__c | VALUE(Text([SBQQ__QuoteLine__c].SBQQ__ListTotal__c |
| Order | Formula | TotalPrice | VALUE(Text([OrderItem].TotalPrice)) |
| Contract | Formula | Amount | VALUE(Text(Contract__c.Amount)) |
| Object | Apex Variable Type | Object Field | Apex Variable Value |
|---|---|---|---|
| Quote Line | Field Reference | SBQQ__Start__Date__c | [SBQQ__QuoteLine__c].SBQQ__StartDate__c |
| Order | Field Reference | Effective-Date | [OrderItem].Order.Effective-Date |
| Contract | Field Reference | ActivatedDate | Contract.ActivatedDate |
Example
- Criteria
- Executes when any of the conditions are met.
- Conditions
-
Field Operator Type Picklist [SBQQ__QuoteLine__c].SBQQ__Quote__r.SBQQ__Status__c Equals Picklist Approved - APEX Variables
- Apex Class: Recognize Revenue
Field Type Value startDate Field Reference [SBQQ__QuoteLine__c].SBQQ__StartDate__c sourceFieldName String blng__Quote__Line__c source Field Reference [SBQQ__QuoteLine__c].Id revenueAmount Formula VALUE(Text([SBQQ__QuoteLine__c].SBQQ__ListTotal__c)) revenueRecognitionRuleId Field Reference [SBQQ__QuoteLine__c].SBQQ__Product__r.blng__RevenueRecognitionRule__r.Id endDate Date [SBQQ__QuoteLine__c].SBQQ__EndDate__c
Example
- Criteria
- Executes when all of the conditions are met.
- Conditions
-
Field Operator Type Picklist Contract Is changed Boolean True Contract Equals Picklist Posted - APEX Variables
- Apex Class: Recognize Revenue
Field Type Value startDate Field Reference Contract.ActivatedDate sourceFieldName String blng__Contract__c source Field Reference Contract.Id revenueAmount Formula VALUE(Text(Contract.blng__Amount__c)) revenueRecognitionRuleId Field Reference [SBQQ__QuoteLine__c].SBQQ__Product__r.blng__RevenueRecognitionRule__r.Id endDate Date 12/31/2019
Example
- Criteria
- Executes when all of the conditions are met.
- Conditions
-
Field Operator Type Picklist [OrderItem].SBQQ__Status__c Is changed Boolean True [OrderItem].SBQQ__Status__c Equals Picklist Activated - APEX Variables
- Apex Class: Recognize Revenue
Field Type Value startDate Field Reference [OrderItem].Order.Effective-Date sourceFieldName String blng__OrderProduct__c source Field Reference [OrderItem].Id revenueAmount Formula [OrderItem].Id revenueRecognitionRuleId Field Reference [OrderItem].Product2.blng_Revenue_Recognition_Rule__r.Id endDate Date [OrderItem].Order.EndDate