Understanding the ON Field Mechanism
Your business may require to automatically set or override certain data on subscriptions and items or on invoices and invoice line items. Think of specific information that you want to display on the final invoice, or that is necessary to make your billing process work.
To this end, JustOn features a mechanism to copy field values from source objects to subscriptions and items during subscription building or to invoices and invoice line items during invoice runs. The feature is based on custom fields whose API names start with
ON_ – hence, it is referred to as ON field mechanism.
In broad outline, the ON field mechanism works as follows:
(1) You define custom fields to hold the data to be copied on any object that is the source for
- Automatic subscription building,
- Usage data billing,
- Generic invoice run or
- Regular invoice generation.
This may include basic objects like Account or Product as well as specific objects like Opportunity/Opportunity Product, Order/Order Product, Case/Case Item, or any other accordingly configured (custom) object that is subject to the automatic subscription build or the invoice run.
(2) When executing the automatic subscription build or the invoice run, JustOn automatically copies the specified data to the corresponding target fields.
Transferring specific information from Salesforce/JustOn to the invoice
The field values are copied if there is a corresponding field on the target object (like
Sequence__c, for example). The API name of the target field must either be the same as the ON field or omit the leading
Sequence__c, for example, are valid target field names). The mechanism is not restricted to specific data types of the ON field or the target field. However, the data types should be compatible. ON fields can be formula fields.
JustOn first tries to copy the ON field value to the target field starting with
ON_. If there is no such field available, the system tries the corresponding field name without the
Subscription building and invoice generation usually involve multiple source objects, where Account and Product always are the most basic ones. They are read first. Other source objects, like, for example, Orders with Order Products or Subscriptions with Items, are input later. Be aware that their information may, consequently, override the original data. For example, if both an account and an order have the same ON field but provide different values, the value specified on the order wins.
Overriding ON field values upon invoice generation
Example Use Cases
Moving Information From Source to Invoice
Think of the following example: You create invoices from opportunities, and there is a piece of information that you keep on opportunities and that is to be displayed on invoices. To this end, you create the (custom) ON field
ON_Information__c on the Opportunity object, and the target field
Information__c on the Invoice object. Remember that the fields must have compatible data types. When creating an invoice from an opportunity, JustOn copies the value of
ON_Information__c (from the opportunity) to
Information__c (on the invoice).
Now assume you involve subscriptions: You first create a subscription from the opportunity, and only then the invoice from the subscription. In this case, you create the ON field
ON_Information__c on the Subscription object, too. JustOn then copies the value of
ON_Information__c on the opportunity to
ON_Information__c on the subscription, then from
ON_Information__c on the subscription to
Information__c on the invoice. Remember, however, that if the subscription gets a new value for
ON_Information__c, then this data is set on the invoice, overriding the value copied from the opportunity.
Using a custom placeholder, you can print the value of
Information__c to the invoice PDF.
Creating Lookup to Source
Assume you first create subscriptions and items from opportunities and opportunity products, and then invoices from these subscriptions. Now you want lookup relations from the subscriptions and items as well as from the invoices and invoice line items to the original source records – the opportunities and opportunity products.
To this end, you create the following fields:
|Object||Field API Name||Data Type||Description|
|Opportunity||ON_OpportunityID||Formula (Text)||Specifies the opportunity ID, using the API name of the ID field
|Subscription||ON_OpportunityID||Lookup (Opportunity)||Links to the related source opportunity.|
|Invoice||ON_OpportunityID||Lookup (Opportunity)||Links to the related source opportunity.|
|Opportunity Product||ON_OpportunityProductID||Formula (Text)||Specifies the opportunity product ID, using the API name of the ID field
|Item||ON_OpportunityProductID||Lookup (Opportunity Product)||Links to the related source opportunity product.|
|Invoice Line Item||ON_OpportunityProductID||Lookup (Opportunity Product)||Links to the related source opportunity product.|
- Insert the opportunity ID and the opportunity product ID to the created ON fields
ON_OpportunityProductIDon the opportunity and opportunity product, respectively,
- On subscription build, copy the values of
ON_OpportunityProductIDto the corresponding fields on the subscription and item, respectively, producing lookup relations to the opportunity and the opportunity product,
- On invoice creation, copy the values of
ON_OpportunityProductIDto the corresponding fields on the invoice and invoice line item, respectively, again producing lookup relations to the opportunity and the opportunity product.
Return to JustOn Administration.