Best Practice: JustOn for Media Cloud
JustOn for Media Cloud integrates JustOn Billing & Invoice Management with Media Cloud, Salesforce's dedicated platform for media and entertainment providers.
Info
Media Cloud is not just another tool but an integral approach to design and launch media experiences, which involves complex product and pricing configurations.
Media Cloud extends Salesforce CRM. It adds components to cover the specific needs of the media industry, including applications that support common media-related business processes, like managing ads, subscribers, licenses, etc., as well as a data model that supports product catalog management with pricing and promotions, selling with opportunities, quotes and orders, and contract lifecycle management (see Media Cloud Foundations | Explore the Solution Components on Salesforce Trailhead).
Solution Outline
Driven by Industries CPQ, a typical quote-to-order process in Media Cloud may be:
(1) After a customer has requested some purchase, you create an opportunity that defines the products – taken from the Enterprise Product Catalog – and their pricing.
(2) Based on the opportunity, you create a quote.
(3) Once the customer has accepted the quote, you create contract and, based on that, the final order to be fulfilled. Industries CPQ applies the pricing to the entire order, involving all applicable discounts: customer-specific prices, promotions, region or bundle-specific prices – you name it.
But what about billing? Enter JustOn Billing & Invoice Management: It takes the orders and generates invoices using the generic invoice run. At that, it does not calculate any prices or discounts – there is Industries CPQ for you. Using the ON field mechanism, however, you can transfer all relevant data to the invoices and have it displayed on the PDF files.
Billing-Specific Configuration
Integrating JustOn's generic invoice run with the outlined Media Cloud solution involves at least the following configuration tasks:
- Adding custom fields to the Order and Order Product objects to control the invoice creation and to retrieve the relevant pricing information
- Creating a generic invoice run filter
- Adjusting the invoice template to display the relevant information
Once set up as outlined, you execute the generic invoice run to create invoices from your orders.
Configuring Order and Order Product
Following the outlined example, orders with order products are the source for your invoice data. That is, you set up the generic invoice run for source objects that are in a parent-child relationship. Consequently, it will take the order to produce the invoice, and the order products to produce the invoice line items.
The invoicing process requires a number of ON fields on both the order and the order product to control the invoice creation as well as to retrieve the relevant information.
-
On the Order object, create the following new fields.
Mandatory fields:
API Name Data Type Possible Value Notes ON_Account Formula (Text) Account.Id
Specifies the related account. ON_Template Formula (Text) Specifies the Salesforce ID or name of the related template.
The formula can return a dedicated template according to specific criteria – target region, business entity, product group, etc.ON_ServiceDate Formula (Date)
Formula (Date/Time)InvoiceServiceDate__c
The record will be invoiced when the date is null
or within the service period of the invoice run.ON_Invoice Lookup (Invoice) The invoice that resulted from this record.
If the produced invoice is canceled, the object records become subject to the invoice run again.ON_LastInvoiceRun Lookup (Invoice Run) Shows the last invoice run that has processed this object. ON_InvoiceBuildError Text (255) Shows errors that occurred during the last invoice run. Depending on your specific use case and its requirements, you may have to copy additional information to the produced invoice, like quote number, contact person, applicable discounts or margins, etc. To this end, you add ON fields for the corresponding data to the Order object and have the ON field mechanism copy it on invoice creation.
Optional fields may include, for example:
API Name Data Type Possible Value Notes ON_Tenant Formula (Text) Specifies the business entity.
The formula can return a dedicated business entity according to specific criteria – target region, product group, etc.ON_PONumber Formula (Text) PoNumber
Specifies the purchase order based on which the current order has been created.
Requires the additonal custom fieldPONumber
on the invoice as the target field.ON_QuoteNumber Formula (Text) Quote.QuoteNumber
Specifies the quote based on which the current order has been created.
Requires the additonal custom fieldQuoteNumber
on the invoice as the target field.ON_ServicePeriodStart Formula (Date) EffectiveDate
Specifies the order start date, can be used as the service period start date of the invoice. ON_ServicePeriodEnd Formula (Date) EndDate
Specifies the order end date, can be used as the service period end date of the invoice. ON_ContactPerson Formula (Text) BillToContact.FirstName + ' ' + BillToContact.LastName
Specifies a contact person for the current order.
Requires the additonal custom fieldContactPerson
on the invoice as the target field.ON_OrderMargin Formula (Percent) vlocity_cmt__OrderMarginTotal__c
Specifies the applicable order margin.
Requires the additonal custom fieldOrderMargin
on the invoice as the target field.ON_Discount Formula (Percent) vlocity_cmt__Discount__c
Specifies the applicable discount.
Requires the additonal custom fieldDiscount
on the invoice as the target field. -
On the Order Product object, create the following new fields.
Mandatory fields:
API Name Data Type Possible Value Notes ON_Title Formula (Text) PricebookEntry.Product2.Name
The name or short description of the invoice line item. ON_Quantity Formula (Number) Quantity
The quantity to be billed for this invoice line item.
Depending on your use case, can also refer tovlocity_cmt__EffectiveQuantity__c
.ON_UnitPrice Formula (Currency) VolumeDiscountedUnitPrice__c
The price of one unit of this invoice line item.
Depending on your use case, can refer toUnitPrice
,ListPrice
orvlocity_cmt__OneTimeCalculatedPrice__c
, for example.
Make sure to retrieve net prices in any case, and have JustOn Billing & Invoice Management do the tax calculation using the proven Tax Rules functionality.Depending on your specific use case and its requirements, you may have to copy additional information to the produced invoice. To this end, you add ON fields for the corresponding data to the Order Product object and have the ON field mechanism copy it on invoice creation.
Optional fields may include, for example:
API Name Data Type Possible Value Notes ON_Description Formula (Text) Description
The description of the invoice line item. ON_AdditionalDiscount Formula (Percent) vlocity_cmt__Additional_Discount__c
Specifies an additional line item discount.
Requires the additonal custom fieldAdditionalDiscount
on the invoice line item as the target field.ON_ItemMargin Formula (Percent) vlocity_cmt__OneTimeMargin__c
Specifies an applicable line item margin.
Requires the additonal custom fieldItemMargin
on the invoice line item as the target field.
Note
Make sure to allowlist any new custom fields on the invoice or invoice line item that act as target fields for the additional order or order product information. Allowlisting makes these fields accessible for custom placeholders.
For details, see Field Whitelist.
Creating Generic Invoice Run Filter
To define which records to include in the invoice run, you create custom filters.
- In Setup, navigate to Custom Settings > Filters.
-
Create the following new filter.
Filter Field Value Name Orders
Target Order
Child Relation
Plural formOrderItems
Use Case Generic
For additional information, see Creating Invoice Run Filter. For help about creating filters, see Filters.
Configuring Template
Adjusting the invoice template to display the relevant information involves two tasks:
- Creating custom placeholders to retrieve the relevant information
- Configuring the invoice line item table to display the relevant information on the PDF
Creating Custom Placeholders
Generally, placeholders are symbols for fields on objects, which are replaced with the actual values from records upon text rendering.
Following the outlined example, you may require the following placeholders to display additional order information on the invoice PDF:
Name | Field | Render as | Source |
---|---|---|---|
PONumber | PONumber__c | TEXT | Default |
QuoteNumber | QuoteNumber__C | TEXT | Default |
ContactPerson | ContactPerson__c | TEXT | Default |
OrderMargin | OrderMargin__c | TEXT | Default |
Discount | Discount__c | TEXT | Default |
AdditionalDiscount | AdditionalDiscount__c | TEXT | InvoiceLineItem |
ItemMargin | ItemMargin__c | TEXT | InvoiceLineItem |
For details on creating custom placeholders, see Custom Placeholders.
Configuring Template Contents
To display the relevant order information on the invoice PDF, you can either adjust the invoice line item table, adding the relevant fields, or specify a dedicated text to include the order data using placeholders.
Assume you want to include the item-specific discount in AdditionalDiscount
in the invoice line item table. To this end, you can specify the following line in the Table Columns
field of your template:
PosNo;Title__c+Description__c;UnitPrice__c;Quantity__c;AdditionalDiscount__c;PosTotalNet__c
This produces the following invoice line item information:
- Position number
- Item title and description
- Item price (the unit price as retrieved from the order product)
- Item quantity
- Discount (the additional discount as retrieved from the order product)
- Item total
For details, see Adjusting Invoice Line Item Table.
Assume you want to disclose the original quote number and the applied order discount below the invoice line item table. To this end, you can specify a text, including the corresonding placeholders, in the Text 2
field of the template:
Original quote number: [QuoteNumber]
Applied order discount: [Discount]
For details, see Editing Standard Text Blocks.
Executing Invoice Run
Once set up, there are multiple ways to invoke the invoice creation process:
- Manual execution from the Invoice Runs tab, as described in Executing a Generic Invoice Run
- Manual execution from the Order detail page, following the setup described in Adding Invoice Build Button
- Automatic execution on a regular basis, as described in Scheduling Invoice Run