Setting Up Revenue Metrics
To set up revenue metrics, configure the components described below. For conceptual background, refer to Revenue Metrics and KPI Metrics.
Revenue metrics compare your realized (invoiced) revenue against your expected (forecasted) revenue on a monthly basis, grouped by business entity, month, and, optionally, product category. Once set up, JustOn maintains the Revenue Reporting Period and Revenue Reporting Detail records that feed the Revenue Metrics Chart and Salesforce reports.
All amounts in revenue metrics are net values (without tax).
Prerequisites
- JustOn Billing & Invoice Management installed in a version that ships the Revenue Metrics objects (Revenue Reporting Period, Revenue Reporting Detail).
- The relevant business entities are configured.
- For forecasting: a parent/child object structure (for example
Order/OrderItems, orOpportunity/OpportunityLineItem) that holds the data you want to forecast from. - Permissions to manage custom settings, object fields, filters, and jobs.
Setting up revenue metrics involves
- Enabling revenue metrics
- Setting up the Forecast Run job
- Creating one or more forecast filters
- Adding the FC fields to the source object
- Optionally, adding the Revenue Metrics Chart to a Lightning page
- Understanding the refresh behavior and how invoiced revenue is created
Once set up, you can use business reports to display the resulting metrics in easy-to-understand formats, in addition to the built-in Revenue Metrics Chart.
(1) Enabling Revenue Metrics
In order to globally enable revenue metrics, the feature must be activated in the global settings.
-
Click to enter Setup, then open Custom Settings.
In Salesforce Lightning, navigate to Custom Code > Custom Settings.
In Salesforce Classic, navigate to Develop > Custom Settings.
-
Click Manage in the row of Global Settings.
- Click Edit in the Default row.
- Select the checkbox
Enable Revenue Metrics. -
Click Save.
Once enabled, JustOn Billing & Invoice Management will create or update RRD and RRP records during the forecast run, invoice finalization, and fix invoices procedures.
Note
Deselecting Enable Revenue Metrics later does not delete records that already exist – it only stops new records from being created. Re-enabling resumes record creation for subsequent runs and finalizations; it does not retroactively create records for the disabled period.
(2) Setting Up Forecast Run Job
JustOn Billing & Invoice Management provides the Forecast Run Job that creates revenue reporting details of the type Forecasted (and the matching periods) from your configured source records. The job can only be started from JustOn's Scheduled Jobs page – there is no trigger for it in the regular invoicing UI.
- Click to access the App Launcher, and select JustOn Billing Configuration.
- Open the Jobs Setup tab.
-
From the
Apex Jobdrop-down list, selectForecast Run Job.The
Job Namefield is automatically set toScheduledForecastRun. -
From the
Start Timedrop-down list, select the preferred execution time.A monthly schedule – for example at the start of each month – is typical.
-
Optionally, edit the displayed cron expression to adjust the execution time.
-
Click Schedule.
This sets up the revenue metrics creation to be executed at the specified time.
Info
From the Scheduled Jobs page, you can also run the job immediately.
(3) Creating Forecast Filters
A filter with the use case Forecast tells the forecast run which source records to process. The run considers all forecast filters at once.
-
Click to enter Setup, then open Custom Settings.
In Salesforce Lightning, navigate to Custom Code > Custom Settings.
In Salesforce Classic, navigate to Develop > Custom Settings.
-
Click Manage in the row of Filters.
- Click New to create a new filter, or Edit to modify an existing filter.
-
Specify the details as necessary.
Option Description Use Case ForecastTarget Object The parent object, for example OrderChild Relation Field The API name of the child relationship that holds the forecast data, for example OrderItemsCondition (optional) A SOQL WHEREcondition that limits which parent records are in scope -
Click Save.
This makes the filter immediately available.
Repeat this step for any additional forecast object combinations you need.
Note
There is no restriction on the Condition value of a forecast filter. Make sure your condition returns exactly the records you intend to forecast.
(4) Adding Forecast Fields to Source Object
During the forecast run, JustOn Billing & Invoice Management reads a fixed set of fields – all prefixed with FC_ – from the child object configured in the filter. Add these fields to that object using exactly the API names below. Each maps to a field on the resulting RRD.
- Navigate to the fields list of the source object.
-
Create the following new fields as required.
Field API Name Data Type Required Target RRD Field Description FC_Amount__cFormula (Currency) Amount Net amount, typically the product of unit price and quantity. Positive → Class==Revenue; negative →Class==Deduction.FC_Account__cFormula (Text) Account Salesforce Account ID for this record. Typically a formula returning the Account ID from the parent (for example Opportunity.AccountId).FC_BusinessEntity__cText Business Entity The business entity name. Must match an existing business entity, can be a formula or populated via a flow. FC_ServicePeriodStart__cDate Service Period Start Start of the service period, determines RRP assignment. FC_ServicePeriodEnd__cDate Service Period End End of the service period, used with the charging plan for period splitting. FC_ChargingPlan__cPicklist Charging Plan Controls how the amount is distributed across months (see below). FC_ProductCategory__cText Product Category Optional grouping label (for example Licence,Support) used for chart filtering and aggregation.FC_Processed__cCheckbox Processing flag, set to trueafter the forecast run processes the record.
Set it back tofalseto force recalculation (see Controlling Update Behavior).For help about creating fields, see Managing Object Fields.
Charging plan: amount distribution
FC_ChargingPlan__c controls how FC_Amount__c is spread across the service period:
| Value | Behavior | Example: Start 01 Jan, End 31 Mar, Amount 300 |
|---|---|---|
| (empty) | One-time item, the full amount is booked in the month of FC_ServicePeriodStart__c. |
1 RRD: Jan = 300 |
Monthly |
The full amount is booked for each month within the service period. | 3 RRDs: Jan 300, Feb 300, Mar 300 |
Annual |
Split into 12 consecutive monthly windows starting from FC_ServicePeriodStart__c. Each window receives FC_Amount__c / 12. |
12 RRDs from Jan, each = 25.00 |
For Annual, small rounding differences are tolerated (for example 100.00 / 12 = 8.33), since a forecast is meant to give a rough overview. If a window's day-of-month does not exist in a later month (for example the 29th in February of a non-leap year), the date is normalized to the last valid day of that month.
(5) Enabling Revenue Metrics Display
Adding Revenue Metrics Chart to Page
The Revenue Metrics Chart is a Lightning Web Component that overlays forecasted and invoiced revenue. You can add it to page of the types App Page or Home Page.
-
Navigate to the Lightning App Builder.
Click to open the Setup menu and select Setup, then open User Interface > Lightning App Builder.
-
Edit an existing page or create a new page.
-
Modify the page layout.
Drag the
Revenue Metrics Chartcomponent (under Custom - Managed) to an appropriate region of the page. -
Optionally, specify a business entity whose data is to be displayed by default.
Users can switch to another business entity directly in the chart at any time.
-
Click Save.
-
Click Activate.
This makes the page available to users, enabling them to easily assess forecasted and invoice revenue. For details on reading the chart, see Using Revenue Metrics.
For help about modifying Lightning pages, see Managing Pages or Create and Configure Lightning Experience Record Pages in the Salesforce Help.
Adding RRD List to Invoice
For troubleshooting purposes, you can let users inspect which RRDs a given invoice has produced. To this end, you add the Revenue Reporting Details related list to the Invoice Lightning record page:
- Click to enter Setup, then navigate to the object management settings of the Invoice (
ONB2__Invoice__c) object. - Click Page Layouts.
- In the Invoice Layout row, click , then select Edit.
- From the Related Lists palette, drag the Revenue Reporting Details list to the Related Lists section.
- Click Save.
- From the object management settings of the Invoice (
ONB2__Invoice__c) object object, click Lightning Record Pages. - Open the Invoice Record Page, and click Edit (or Clone if you edit the record page for the first time).
- Drag the Related List - Single component to an appropriate section of the page.
- In the
Related Listfield of the component properties, selectRevenue Reporting Details. - Click Save.
-
Click Activate.
This makes the customized record page available to users, enabling them to see which RRDs a given invoice has produced.
(6) Controlling Update Behavior
When the forecast run executes, it queries the child records where the FC_Processed__c field is set false, builds the forecasted RRDs from their FC fields, creates or updates the matching RRPs, and then sets FC_Processed__c to true on the processed records.
Because of this flag, a re-run does not automatically reprocess records that were already handled. To force a recalculation after changing values on a source record:
- Set
FC_Processed__ctofalseon the relevant child record(s). -
Execute the forecast run again.
The next run deletes all forecasted RRDs associated with those records and recreates them from the current FC field values. The RRP itself is kept (its amount fields are recalculated) and may temporarily remain without any associated RRDs.
Note
JustOn does not reset FC_Processed__c back to false by default. Do this through your own automation – for example a Salesforce flow – whenever a source record should be reconsidered, including when a new child item is added.
Realized Revenue: Invoice Finalization, Cancellation, and Fix Invoices
The realized side (Type == Invoiced) is produced automatically by your normal invoicing processes – no extra configuration is needed beyond enabling the global setting.
- Invoice Finalization
- When an invoice is finalized, JustOn Billing & Invoice Management reads its invoice line items, applies the configured revenue recognition rules to split amounts across months (when a service period spans several months), creates
Type==InvoicedRRDs, and creates or updates the matching RRP. Forecasted RRDs in the same period are left untouched. - Cancellation
- When an invoice is canceled, its
Type==InvoicedRRDs are deleted and the affected RRP amount fields are recalculated. The RRP remains, and forecasted RRDs are not affected. - Fix Invoices
-
To create revenue metrics for already finalized invoices – for example if you enabled the feature after finalizing, or changed a field such as
Product Category– you use the Fix Invoices procedure and select theCreate Revenue Metricscheckbox in the dialog. It applies the same logic as invoice finalization runs: if RRDs already exist for the selected invoices, they are deleted and recreated, and the RRP amount fields are recalculated.The
Create Revenue Metricscheckbox is disabled while the global settingEnable Revenue Metricsis off.
Product Category Aggregation
To cluster revenue by service group (for example licences, one-time items, support, maintenance), populate the product category:
- For invoiced details: via the ON field mechanism on the invoice line item or item (it can also be a formula or set by a flow).
- For forecasted details: via
FC_ProductCategory__con the source record.
RRDs of the same invoice that share the same Product Category and Class are aggregated into one RRD. The combined Invoice Line Items field then lists the contributing line item names. If the same product category produces both revenue and deduction amounts, JustOn Billing & Invoice Management creates a separate RRD per class.
Building Reports on Revenue Metrics
Beyond the built-in chart, you can use Business Reports or standard Salesforce reports on the Revenue Reporting Period and Revenue Reporting Detail objects to analyze forecasted and invoiced amounts by business entity, month, year, and product category.