Batch Invoice Scheduler (POST, PUT)

Create or update an invoice scheduler to automatically generate invoices. Use the criteria and filters of the invoice scheduler to set up the invoice run schedules based on your requirements.

Special Access Rules 

You need the Billing Operations User and Data Pipelines Base User permission sets to use this API. See Data Pipelines.

Resource 

1/commerce/invoicing/invoice-schedulers
1/commerce/invoicing/invoice-schedulers/{billingBatchSchedulerId}

Resource Example 

1https://{yourInstance}.salesforce.com/services/data/v68.0/commerce/invoicing/invoice-schedulers
1https://{yourInstance}.salesforce.com/services/data/v68.0/commerce/invoicing/invoice-schedulers/{5BSxx0000004TwGGAU}

Available Version 

62.0

HTTP Methods 

POST, PUT

PUT is supported in version 63.0 and later for invoice schedulers with Draft or Inactive status.

Request Body for POST 

JSON Example

This example shows a sample request to create an invoice scheduler that generates invoices once.

1{
2  "schedulerName": "InvoiceScheduler",
3  "startDate": "2024-05-06",
4  "invoiceStatus": "POSTED",
5  "preferredTime": "00:45",
6  "targetDate": "2024-05-22",
7  "invoiceDate": "2024-05-22",
8  "frequencyCadence": "Once",
9  "frequencyCadenceOptions": {},
10  "timezone": "Asia/Kolkata",
11  "status": "Active",
12  "filterCriteria": [
13    {
14      "operation": "InList",
15      "value": "Batch 2,Batch 3,Batch 4",
16      "criteriaSequence": 1,
17      "objectName": "BillingSchedule",
18      "fieldName": "InvoiceRunMatchingValue"
19    },
20    {
21      "operation": "Equals",
22      "value": "001xx000003GZG5AAO",
23      "criteriaSequence": 2,
24      "objectName": "BillingSchedule",
25      "fieldName": "BillingAccount"
26    },
27    {
28      "operation": "Equals",
29      "value": "0fwxx0000000001AAA",
30      "criteriaSequence": 3,
31      "objectName": "BillingScheduleGroup",
32      "fieldName": "LegalEntity"
33    },
34    {
35      "operation": "InList",
36      "value": "OneTime,Recurring",
37      "criteriaSequence": 4,
38      "objectName": "BillingSchedule",
39      "fieldName": "BillingTermUnit"
40    },
41    {
42      "operation": "Equals",
43      "value": "USD",
44      "criteriaSequence": 5,
45      "objectName": "BillingSchedule",
46      "fieldName": "Currency_Iso_code"
47    }
48  ]
49}

This example shows a sample request to create an invoice scheduler that generates invoices daily.

1{
2  "schedulerName": "InvoiceScheduler",
3  "startDate": "2024-05-06",
4  "endDate": "2026-05-06",
5  "invoiceStatus": "POSTED",
6  "preferredTime": "00:45",
7  "targetDateOffset": 0,
8  "invoiceDateOffset": 0,
9  "isInvoiceDateFromRunDate": true,
10  "frequencyCadence": "Daily",
11  "frequencyCadenceOptions": {},
12  "timezone": "Asia/Kolkata",
13  "status": "Active",
14  "filterCriteria": [
15    {
16      "operation": "InList",
17      "value": "Batch 2,Batch 3,Batch 4",
18      "criteriaSequence": 1,
19      "objectName": "BillingSchedule",
20      "fieldName": "InvoiceRunMatchingValue"
21    },
22    {
23      "operation": "Equals",
24      "value": "001xx000003GZG5AAO",
25      "criteriaSequence": 2,
26      "objectName": "BillingSchedule",
27      "fieldName": "BillingAccount"
28    },
29    {
30      "operation": "Equals",
31      "value": "0fwxx0000000001AAA",
32      "criteriaSequence": 3,
33      "objectName": "BillingScheduleGroup",
34      "fieldName": "LegalEntity"
35    },
36    {
37      "operation": "InList",
38      "value": "OneTime,Recurring",
39      "criteriaSequence": 4,
40      "objectName": "BillingSchedule",
41      "fieldName": "BillingTermUnit"
42    },
43    {
44      "operation": "InList",
45      "value": "USD",
46      "criteriaSequence": 5,
47      "objectName": "BillingSchedule",
48      "fieldName": "Currency_Iso_code"
49    }
50  ]
51}

This example shows a sample request to create an invoice scheduler that generates invoices weekly.

1{
2  "schedulerName": "InvoiceScheduler",
3  "startDate": "2024-05-06",
4  "endDate": "2026-05-06",
5  "invoiceStatus": "POSTED",
6  "preferredTime": "00:45",
7  "targetDateOffset": 0,
8  "invoiceDateOffset": 0,
9  "isInvoiceDateFromRunDate": false,
10  "frequencyCadence": "Weekly",
11  "frequencyCadenceOptions": {
12    "recursOnDay": "Sunday"
13  },
14  "timezone": "Asia/Kolkata",
15  "status": "Active",
16  "filterCriteria": [
17    {
18      "operation": "InList",
19      "value": "Batch 2,Batch 3,Batch 4",
20      "criteriaSequence": 1,
21      "objectName": "BillingSchedule",
22      "fieldName": "InvoiceRunMatchingValue"
23    },
24    {
25      "operation": "Equals",
26      "value": "001xx000003GZG5AAO",
27      "criteriaSequence": 2,
28      "objectName": "BillingSchedule",
29      "fieldName": "BillingAccount"
30    },
31    {
32      "operation": "Equals",
33      "value": "0fwxx0000000001AAA",
34      "criteriaSequence": 3,
35      "objectName": "BillingScheduleGroup",
36      "fieldName": "LegalEntity"
37    },
38    {
39      "operation": "InList",
40      "value": "OneTime,Recurring",
41      "criteriaSequence": 4,
42      "objectName": "BillingSchedule",
43      "fieldName": "BillingTermUnit"
44    },
45    {
46      "operation": "Equals",
47      "value": "USD",
48      "criteriaSequence": 5,
49      "objectName": "BillingSchedule",
50      "fieldName": "Currency_Iso_code"
51    }
52  ]
53}

This example shows a sample request to create an invoice scheduler that generates invoices monthly on a specific date.

1{
2  "schedulerName": "InvoiceScheduler",
3  "startDate": "2024-05-06",
4  "endDate": "2026-05-06",
5  "invoiceStatus": "POSTED",
6  "preferredTime": "00:45",
7  "targetDateOffset": 0,
8  "invoiceDateOffset": 0,
9  "isInvoiceDateFromRunDate": false,
10  "frequencyCadence": "Monthly",
11  "frequencyCadenceOptions": {
12    "recurringSubType": "SpecificDate",
13    "recursOnDate": "L-1",
14    "shouldExcludeWkendAndHldy": true
15  },
16  "timezone": "Asia/Kolkata",
17  "status": "Active",
18  "filterCriteria": [
19    {
20      "operation": "InList",
21      "value": "Batch 2,Batch 3,Batch 4",
22      "criteriaSequence": 1,
23      "objectName": "BillingSchedule",
24      "fieldName": "InvoiceRunMatchingValue"
25    },
26    {
27      "operation": "Equals",
28      "value": "001xx000003GZG5AAO",
29      "criteriaSequence": 2,
30      "objectName": "BillingSchedule",
31      "fieldName": "BillingAccount"
32    },
33    {
34      "operation": "Equals",
35      "value": "0fwxx0000000001AAA",
36      "criteriaSequence": 3,
37      "objectName": "BillingScheduleGroup",
38      "fieldName": "LegalEntity"
39    },
40    {
41      "operation": "InList",
42      "value": "OneTime,Recurring",
43      "criteriaSequence": 4,
44      "objectName": "BillingSchedule",
45      "fieldName": "BillingTermUnit"
46    },
47    {
48      "operation": "Equals",
49      "value": "USD",
50      "criteriaSequence": 5,
51      "objectName": "BillingSchedule",
52      "fieldName": "Currency_Iso_code"
53    }
54  ]
55}

This example shows a sample request to create an invoice scheduler that runs immediately.

1{
2    "schedulerName": "InvoiceScheduler",
3    "status": "Draft",
4    "invoiceStatus": "Posted",
5    "frequencyCadenceOptions": {
6        "shouldStartRunImmediately": true
7    },
8    "frequencyCadence": "Once",
9    "targetDate": "2024-08-28",
10    "invoiceDate": "2024-08-28",
11    "filterCriteria": [
12        {
13            "operation": "InList",
14            "value": "Batch 2,Batch 3,Batch 4",
15            "criteriaSequence": 1,
16            "objectName": "BillingSchedule",
17            "fieldName": "InvoiceRunMatchingValue"
18        },
19        {
20            "operation": "Equals",
21            "value": "001xx000003GZG5AAO",
22            "criteriaSequence": 2,
23            "objectName": "BillingSchedule",
24            "fieldName": "BillingAccount"
25        },
26        {
27            "operation": "Equals",
28            "value": "0fwxx0000000001AAA",
29            "criteriaSequence": 3,
30            "objectName": "BillingScheduleGroup",
31            "fieldName": "LegalEntity"
32        },
33        {
34            "operation": "InList",
35            "value": "OneTime,Recurring",
36            "criteriaSequence": 4,
37            "objectName": "BillingSchedule",
38            "fieldName": "BillingTermUnit"
39        },
40        {
41            "operation": "Equals",
42            "value": "USD",
43            "criteriaSequence": 5,
44            "objectName": "BillingSchedule",
45            "fieldName": "Currency_Iso_code"
46        }
47    ]
48}

Properties

NameTypeDescriptionRequired or OptionalAvailable Version
billing​CycleCountIntegerNumber of billing cycles or billing periods to be invoiced.Optional68.0
endDateStringEnd date of the invoice scheduler.Optional63.0
filter​CriteriaBatch Invoice Filter Criteria Input[]List of line items of the filter criteria.Optional62.0
frequency​CadenceStringFrequency to run the invoice scheduler.Required62.0
frequency​Cadence​OptionsFrequency Cadence OptionsFrequency cadence options for the invoice scheduler.Required62.0
invoice​DateStringDate shown on the invoice. This date is also used for tax calculations.Required if the frequency​Cadence property is set to Once.62.0
invoiceDate​OffsetIntegerOffset applied to the target date, which is the number of days added to or subtracted from the invoice date, to calculate the updated invoice date.Required if the frequency​Cadence property is set to Daily, Weekly, or Monthly.62.0
invoice​StatusStringStatus of the invoice that specifies the expected invoice status from an invoice batch run. Valid values are Draft or Posted.Required62.0
isInvoice​DateFrom​RunDateBooleanIndicates whether the invoice date is applicable from the date when the invoice scheduler is run (true) or not (false).Optional63.0
jobTypeStringType of job the scheduler runs. Valid values are Catchup, Forecast, Invoice, or Payment.Optional68.0
preferred​TimeStringPreferred time for the invoice batch run.Required62.0
scheduler​NameStringName of the invoice scheduler, which must be unique in your org.Required62.0
should​CatchUp​BillRunBooleanIndicates whether the invoice batch run advances billing schedules to a target date without generating invoices for prior billing periods (true) or not (false).Optional68.0
should​Generate​Invoice​DocumentsBooleanIndicates whether invoice documents are automatically generated during batch processing for runs triggered by the scheduler (true) or not (false).Optional68.0
should​Recalculate​AllForecastLnBooleanIndicates whether to recalculate all forecast lines for all billing schedules regardless of forecast status (true) or only eligible ones (false). Applies only to forecast job runs.Optional68.0
startDateStringStart date of the invoice scheduler.Required62.0
statusStringStatus of the invoice scheduler. Valid values are Draft, Active, or Inactive.Required62.0
target​DateStringTarget date of the invoice batch run. Billing schedules having the next billing date before this date are picked up for invoicing. The target date must be less than or equal to the maximum allowed target date for the org.Required if the frequency​Cadence property is set to Once.62.0
target​DateOffsetIntegerTarget date offset applied to the next invoice run date to calculate the target date. The offset is the number of days added to or subtracted from the next billing date.Required if the frequency​Cadence property is set to Daily, Weekly, or Monthly.62.0
target​Day​OfMonthIntegerDay of the month to use for calculating the target date. Values are 1 through 28, -3 (third-to-last day), -2 (second-to-last day), or -1 (last day).Optional68.0
target​Month​OffsetIntegerNumber of months relative to each scheduled run for calculating the target date. For example, 0 is the current month, 1 is the next month, and -1 is the previous month.Optional68.0
timezoneStringTime zone that’s applicable for the invoice scheduler.Optional62.0

Valid values are:

  • Once
  • Daily
  • Weekly
  • Monthly

Response Body for POST 

Batch Invoice Scheduler