Skip to content

Scheduling Exports

You can schedule exports to run automatically on a regular basis.

The scheduled export requires additional options. To this end, you set up the export to be executed with additional parameters.

The following parameters are available:

Parameter Possible Values Description Note Example Values
ExportSettings comma-separated list of export setting names Specifies which export configuration settings for invoices or booking details are processed when the export runs. Mandatory MyCsvExport1, MyCsvExport2
Interval x(d|w|m) Specifies the export 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 export period is the next month.
Interval = -3m (negative value) and Alignment = current means that the export period is the current and the last two months.
Interval = 1w and Alignment = previous means that the export period is the previous week.
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. Optional -5
StartOfWeek 1 .. 7 Specifies the start day of the week, with 1 = Monday ... 7 = Sunday. Defaults to 1 if left empty. Optional 1
PaymentDate (start|end)(+|-)x Specifies the payment date based on the calculated start date or end date, where x is a number of days. Optional, applicable for invoice exports only end-5
CreatePayments false|true Determines whether to create payment balances on the invoices upon exporting. Defaults to false. Optional, applicable for invoice exports only true
BusinessEntities comma-separated list of business entities Specifies for which business entities the booking details are to be exported. Defaults to all business entities.
For compatibility reasons, JustOn supports the parameter name Tenants.
Optional, applicable for booking detail exports only EMEA,APAC

Setting up a parameterized export involves two steps:

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

Configuring Export 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: ExportChain
    • Parameter 1..8: Define batch chain-specific execution options using the syntax parameter = value, for example, Interval = 2w or Alignment = next
  5. Click Save.

ExportChain parameters example

Export invoices of the current week:

Field Value Description
Name week_exp_schedule Must match the Job Name to be set when scheduling the job
Batch Chain ExportChain
Parameter 1 Interval = 1w Sets the invoice run period to one week
Parameter 2 Alignment = current Sets the invoice run period to the current interval period
Parameter 3 ExportSettings = OpenInvCSVExport Applies the export configuration settings OpenInvCSVExport, which must be defined in Export Settings

Use a corresponding cron expression to schedule the export for a specific day of the week. If you want, for example, to export the invoices every Saturday night at 23:00, use 0 0 23 ? * 7.

For details, see Scheduling Concepts and Defining Batch Parameters.

Scheduling Export 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/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.
  5. Click Schedule.

    This sets up the export 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
  4. Click Save.

    This sets up the export 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.