Skip to content

Managing Invoice Runs

The invoice run is the core concept of JustOn. It is the operation that creates invoices based on

  • customer and contract data as stored in the subscription,
  • product and price information stored in subscription items,
  • usage data available via transactions (see Usage Data Billing),
  • customer and product data as stored in an arbitrary object, if set up accordingly (see Billing Arbitrary Objects),
  • customer and product data as stored in an opportunity, if set up accordingly (see Enabling Opportunity Billing).

Managing invoice runs may involve the following tasks:

Executing an Invoice Run

To execute an invoice run:

  1. Open the Invoice Runs tab.
  2. Click New.
  3. Specify the configuration details as necessary.

    • Period Start/Period End: Specifies the period for the invoice run.
    • Invoice Date: Specifies the date of issue for all invoices. If left empty, JustOn uses the current date.
  4. Select the invoice run filter as required.

    If you use filter groups, select a filter group first in order to narrow down the number of available filters.

    To limit the scope of subscriptions that are subject to an invoice run, select a subscription filter.

  5. Click Start.

    This creates draft invoices from all subscriptions that are set Active and that are associated with an active account.

Info

In order to be considered by the invoice run, a subscription's start date must be within the invoice run period. This also applies to the start dates of the subscription items as well as to the transaction date.

Next steps:

Editing Invoices
Finalizing Invoices

Executing a Generic Invoice Run

In addition to the usual invoice run, which processes subscriptions, you can execute a generic invoice run to create invoices from arbitrary objects that are configured accordingly.

Note

Make sure that the generic invoice run is enabled. For details, see Billing Arbitrary Objects.

Propagating associated documents

During the generic invoice run, JustOn can link documents that are associated to (parent or child) source records with the resulting invoice. The linked documents are then attached to the invoice upon distribution (emailing, etc.) and sent to the corresponding recipient.

The setting is made using a checkbox on document basis. If required by your business case, make sure that the intended documents are selected accordingly.

When selecting attachments, be aware of the email size limit imposed by Salesforce. If set up accordingly, the maximum size of one email is 25 MB, which includes the body, headers and attachments (see General email limits in the Salesforce Help). That is, an email with a 25 MB attachment will exceed this limit and would, consequently, not be processed.

For details, see Propagating Associated Documents.

To execute a generic invoice run:

  1. Open the Invoice Runs tab.
  2. Click New.
  3. Specify the configuration details as necessary.

    • Period Start/Period End: Specifies the period for the invoice run.
    • Invoice Date: Specifies the date of issue for all invoices. If left empty, JustOn uses the current date.
  4. Select the invoice run filter as required.

    If you use filter groups, select a filter group first in order to narrow down the number of available filters.

    To define which records to include in the invoice run, select one or more generic filters.

  5. Click Start.

    This creates draft invoices from all accordingly configured objects that match the filter criteria.

Info

If you start the invoice run from a parent object, you are presented the following options:

  • A picklist for selecting applicable filters
  • A list of source records that link to the current parent record

    You can (de)select individual records. If more than 50 records are in the scope, JustOn will not display the list, but directly process all related records.

  • A date range to limit records based on ON_ServiceDate

Next steps:

Editing Invoices
Finalizing Invoices

Executing an Opportunity Invoice Run

You can execute an opportunity invoice run to create invoices from opportunities. Doing so produces one invoice per account, that is, multiple opportunities for one account are billed to the same invoice. Note that during the invoice run, JustOn initially creates the invoices from subscriptions, and then reuses the available invoices for the opportunity billing.

Note

Make sure that opportunity billing is enabled. For details, see Enabling Opportunity Billing.

To execute an opportunity invoice run:

  1. Open the Invoice Runs tab.
  2. Click New.
  3. Specify the configuration details as necessary.

    • Period Start/Period End: Specifies the period for the invoice run.
    • Invoice Date: Specifies the date of issue for all invoices. If left empty, JustOn uses the current date.
  4. Select the invoice run filter as required.

    If you use filter groups, select a filter group first in order to narrow down the number of available filters.

    To define which opportunities to include in the invoice run, select an opportunity filter.

  5. Click Start.

    This creates draft invoices from all subscriptions that are set Active and that are associated with an active account, as well as from all active opportunities that match the filter criteria.

Next steps:

Editing Invoices
Finalizing Invoices

Reviewing and Completing an Invoice Run

After creating draft invoices, you check them for correctness. If necessary, you must edit the draft invoices.

There are two ways to review generated draft invoices:

  • via the invoice detail view
  • using the draft PDF preview

To access the invoice detail view:

  1. Navigate to the Invoices list in the invoice run view or open the Invoices tab.
  2. Click the ID of the invoice you want to review.

    This opens the invoice in the detail view.

To preview the draft PDF documents of the invoices:

  1. Navigate to the Invoices list in the invoice run view, or open the Invoices tab and select an appropriate list view.

    The list view Recently Viewed does not display the Preview button.

  2. Click to open the action menu, then select Preview.

    This opens the draft PDF documents in a preview mode.

    Clicking Next or Previous allows you to navigate between the previewed invoices.

    Clicking View opens the detail view of the currently previewed invoice.

Next steps:

Editing Invoices
Finalizing Invoices

Re-Running an Invoice Run

If there have been deleted draft invoices from the latest invoice run, you can restore the invoices based on the corresponding subscription or opportunity. Re-running the invoice run applies the initial configuration (start date, end date, invoice date, etc.).

To repeat the invoice run in order to restore missing invoices:

  1. Open the Invoice Runs tab.
  2. Click the ID of the latest invoice run.
  3. Click View Remaining.
  4. Select the checkboxes of the remaining subscriptions/opportunities for which to create invoices.
  5. Click Start.

    This restores the missing invoices, applying the original configuration.

Next steps:

Editing Invoices
Finalizing Invoices

Creating Draft PDF

For review or testing purposes, your business may require to generate PDF files from multiple invoices in the status Draft.

Note

Make sure that the button Create Draft PDFs as well as a file distribution target for draft documents are available, see Enabling Draft PDF Generation.

To do so:

  1. Navigate to the Invoices list in the invoice run view, or open the Invoices tab and select an appropriate list view.

    The list view Recently Viewed does not display the Create Draft PDFs button.

  2. On the Invoices tab, select the checkboxes next to the invoices you want to include in the draft PDF generation, or leave all checkboxes unmarked to include all listed invoices.

  3. Click to open the action menu, then select Create Draft PDFs.
  4. Click Continue to confirm the operation.

    This creates PDF files for all selected draft invoices. The produced files are not associated to the invoice records to prevent inconsistencies with finalized invoices. Find all produced files in the file distribution target defined for draft invoices.

    There must be at least one active file distribution target marked as Draft Folder. For details, see File Distribution.

Next steps:

Editing Invoices
Finalizing Invoices

Scheduling Invoice Run

You can schedule the invoice run to have invoices created automatically on a regular basis.

Parameterized Invoice Run

The scheduled invoice run may require additional options. To this end, you can set up the invoice run to be executed with additional parameters.

The following parameters are available:

Parameter Possible Values Description Example Values
Interval x(d|w|m) Specifies the invoice run period, where x is an integer, d=day, w=week, m=month.
Defaults to 1m.
2w
x-y x and y are positive integers (1 .. 31), where x-y specifies a day range for a month. If x>y, then x is considered a day of the previous month. 1-15
Alignment previous, current or next Used to describe the Interval position relative to the execution time.
Interval = 1m and Alignment = next means that the invoice run period is the next month.
Interval = -3m (negative value) and Alignment = current means that the invoice run period is the current and the last two months.
Interval = 1w and Alignment = previous means that the invoice run period is the previous week.
If not set, defaults to previous.
next
ShiftDays x Usually, the time period calculation is based on the current date. This integer specifies a number of days by which the "anchor date" is to be moved backward or forward. -5
StartOfWeek 1 .. 7 Specifies the start day of the week, with 1 = Monday ... 7 = Sunday. Defaults to 1 if left empty. 1
InvoiceDate (start|end)(+|-)x Specifies the invoice date based on the start date or end date of the invoice run, where x is a number of days. end-5
InvoiceRunFilter <string> Specifies the name of a filter to be applied as taken from the custom setting Filters <filter name>
OpportunityInvoiceRunFilter <string> Specifies the name of a opportunity filter to be applied as taken from the custom setting Filters <filter name>
TransactionFilters <string> Specifies the names of the transaction filters to be applied as taken from the custom setting Filters (comma-separated list) <filter name list>
GenericFilters <string> Specifies the names of the generic invoice run filters to be applied as taken from the custom setting Filters (comma-separated list) <filter name list>

Info

If the calculated invoice run period and the specified filters belong to an existing invoice run, then JustOn uses the existing invoice run instead of creating a new one.

Setting up a parameterized invoice run involves two steps:

  • Defining parameters for the batch chain
  • Scheduling the batch chain

Configuring Batch Chain Parameters

  1. In Setup, open Custom Settings.

    In Salesforce Lightning, navigate to Custom Code > Custom Settings.

    In Salesforce Classic, navigate to Develop > Custom Settings.

  2. Click Manage in the row of Batch Parameters.

  3. Click New.
  4. Specify the details as required.

    • Name: Must match the Job Name to be set when scheduling the job
    • Batch Chain: InvoiceRunChain
    • Parameter 1..8: Define batch chain-specific execution options using the syntax

      <parameter> = <value>

  5. Click Save.

InvoiceRunChain parameters example
Field Value Description
Name ir_schedule_1 Must match the Job Name to be set when scheduling the job
Batch Chain InvoiceRunChain
Parameter 1 Interval = 2w Sets the invoice run period to two weeks
Parameter 2 InvoiceDate = end-1 Sets the invoice date to the penultimate day of the invoice run period
Parameter 3 InvoiceRunFilter = MySubscriptions Sets the invoice run filter to MySubscriptions, which must be defined in Filters
Parameter 4 TransactionFilters = Cases,Orders Sets the transaction filters to Cases and Orders, which must be defined in Filters

Scheduling Batch Chain

To schedule the batch chain, you can use either JustOn's Scheduled Jobs page or Salesforce's Schedule Apex functionality. For details, see Scheduling a Job.

Via JustOn's Scheduled Jobs page:

  1. Open the Scheduled Jobs page.

    Use the following URL https://login.salesforce.com/apex/ONB2__JobsSetup, or, if you are already logged in, append apex/apex/ONB2__JobsSetup to your org's domain name.

    As of JustOn 2.52, you can access the Scheduled Jobs page via the JustOn configuration app (App Launcher > JustOn Configuration > Jobs Setup).

  2. From the Apex Job drop-down list, select Batch Chain Job.

  3. In the Job Name field, specify the name of the batch parameters setting created before.
  4. From the Start Time drop-down list, select the preferred execution time.

    Your business may require to schedule multiple invoice runs. In order to prevent concurrent access to records or batch job limitations, they should, however, not run in parallel. Therefore, JustOn recommends to involve a certain time delay between the scheduled invoice runs - for example, one at 00:00, the next at 01:00, and so on. The interval may vary depending on the amount of records to be processed.

  5. Click Schedule.

    This sets up the invoice run to be executed on a regular basis at the specified time with the additional parameters set.

Info

From the Scheduled Jobs page, you can also run the batch chain immediately.

Via Salesforce's Schedule Apex functionality:

  1. In Setup, open Apex Classes.

    In Salesforce Lightning, navigate to Custom Code > Apex Classes.

    In Salesforce Classic, navigate to Develop > Apex Classes.

  2. Click Schedule Apex on top of the list.

  3. Specify the details as required.

    • Job Name: The name of the batch parameters setting created before
    • Apex Class: ScheduledBatchChain
    • Frequency
    • Start
    • End
    • Preferred Start Time

    Your business may require to schedule multiple invoice runs. In order to prevent concurrent access to records or batch job limitations, they should, however, not run in parallel. Therefore, JustOn recommends to involve a certain time delay between the scheduled invoice runs - for example, one at 00:00, the next at 01:00, and so on. The interval may vary depending on the amount of records to be processed.

  4. Click Save.

    This sets up the invoice run to be executed on a regular basis at the specified time with the additional parameters set.

For more details about job scheduling, see Scheduling a Job in the JustOn documentation and Schedule Apex in the Salesforce Help.

Monthly Invoice Run

You can schedule the invoice run to have invoices created automatically once a month. To do so:

  1. In Setup, open Apex Classes.

    In Salesforce Lightning, navigate to Custom Code > Apex Classes.

    In Salesforce Classic, navigate to Develop > Apex Classes.

  2. Click Schedule Apex on top of the list.

    schedule_ir_job
    Scheduling the invoice run

  3. Specify the details as required.

    • Job Name
    • Apex Class: ScheduledMonthlyInvoiceRun
    • Frequency: Monthly with an according day of month setting
    • Start
    • End
    • Preferred Start Time
  4. Click Save.

    This sets up the invoice run to be executed on a regular basis at the specified time.

For the invoice run parameters, the following values are applied by default:

Invoice Run Parameter Value
Start Date Sets the first day of the month before the invoice run has been executed
End Date Sets the last day of the month before the invoice run has been executed
Invoice Date If empty, sets the date of the invoice run execution

For more details about job scheduling, see Scheduling a Job in the JustOn documentation and Schedule Apex in the Salesforce Help.

Return to JustOn Operation.