Batch Parameters
Batch parameters control the execution behavior of a batch chain, a series of several linked complex operations, which are executed sequentially on multiple records (as selected from list views) at the same time.
Common parameters
Common batch chain parameters that can be used with various batch chains include:
| Parameter | Possible Values | Description |
|---|---|---|
| Interval | x(d|w|m) |
Specifies the period to be considered by the business process (invoice run, export, etc.), where x is an integer, d=day, w=week, m=month.Defaults to 1m. |
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.The execution date determines which month is used as the base: if the execution day is before x, the system automatically shifts back one month. See the warning below. |
|
| Alignment | previous, current or next |
Used to describe the Interval position relative to the execution time.Interval = 1m and Alignment = next means that the considered period is the next month.Interval = -3m (negative value) and Alignment = current means that the considered period is the current and the last two months.Interval = 1w and Alignment = previous means that the considered period is the previous week.If not set, defaults to previous. |
| ShiftDays | x |
Optional. 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. |
| StartOfWeek | 1 .. 7 |
Optional. Specifies the start day of the week, with 1 = Monday ... 7 = Sunday. Defaults to 1 if left empty. |
Execution date and day-range intervals
When using a day-range interval (Interval = x-y), the execution date of the scheduled job significantly affects the resulting period.
The system first determines the current interval based on the execution date:
- If the execution day is within the range (
x<= day <=y), the current month is used as the base. - If the execution day is before the start of the range (day <
x), the system shifts back one month to find the most recent matching interval.
This implicit shift happens before the Alignment parameter is applied. Combining a day-range interval with Alignment = previous can therefore cause a double shift, producing an unexpected date range.
Interval = 16-31, job scheduled to run at the beginning of each month, for example, the 3rd:
| Execution Date | Base Period (implicit) |
Alignmentprevious |
current |
|---|---|---|---|
| Dec 3 (day < 16) | Nov 16–30 (shifted) | Oct 16–31 | Nov 16–30 |
| Dec 18 (day >= 16) | Dec 16–31 (no shift) | Nov 16–30 | Dec 16–31 |
If the scheduled job runs outside the day range (for example, on the 1st–15th for an interval of 16-31), use Alignment = current to avoid the double shift. If the job runs within the day range, Alignment = previous works as expected.
You can define multiple batch parameters settings:
-
Click to enter Setup, then open Custom Settings.
In Salesforce Lightning, navigate to Custom Code > Custom Settings.
In Salesforce Classic, navigate to Develop > Custom Settings.
-
Click Manage in the row of Batch Parameters.
- Click New.
-
Specify the details as required.
- Name: Must match the
Job Nameto be set when scheduling the job - Batch Chain: The name of the batch chain to be executed as listed in Scheduling Concepts
- Parameter 1..8: Define batch chain-specific execution options using the syntax
parameter = value, for example,Interval = 2worAlignment = next
- Name: Must match the
-
Click Save.
Info
The ExportChain, InvoiceRunChain and TransactionBuilderChain require parameters.
ExportChain parameters example
Export invoices for 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.
InvoiceRunChain parameters examples
Create invoices for the past two weeks:
| 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 With the default alignment setting ( Alignment = previous), the invoice run period is the past 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 |
Create invoices for the next month one week before it starts:
| Field | Value | Description |
|---|---|---|
| Name | ir_schedule_2 |
Must match the Job Name to be set when scheduling the job |
| Batch Chain | InvoiceRunChain |
|
| Parameter 1 | Alignment = current |
Sets the invoice run period to the current interval period With the default interval setting ( Interval = 1m), the invoice run period is the current month. |
| Parameter 2 | ShiftDays = 7 |
Moves the time period calculation seven days forward (so that current actually starts one week earlier) |
| Parameter 3 | InvoiceRunFilter = MySubscriptions |
Sets the invoice run filter to MySubscriptions, which must be defined in Filters |
InvoiceRunChain day-range interval example
Create invoices for the second half of the month (days 16–31), with the job running in the first half of the following month:
| Field | Value | Description |
|---|---|---|
| Name | ir_schedule_halfmonth |
Must match the Job Name to be set when scheduling the job |
| Batch Chain | InvoiceRunChain |
|
| Parameter 1 | Interval = 16-31 |
Sets the invoice run period to days 16 through 31 of a month |
| Parameter 2 | Alignment = current |
Uses the base period as-is, without additional shift |
| Parameter 3 | GenericFilters = Rechnung |
Sets the generic filter |
| Parameter 4 | InvoiceDate = end-0 |
Sets the invoice date to the last day of the invoice run period |
TransactionBuilderChain parameters example
| Field | Value | Description |
|---|---|---|
| Name | buildtransactions |
Must match the Job Name to be set when scheduling the job |
| Batch Chain | TransactionBuilderChain |
|
| Parameter 1 | TransactionFilters = transactions1 |
Specifies the transaction filter to be used |
BatchBalanceExportJob parameters example
| Field | Value | Description |
|---|---|---|
| Name | BatchBalanceExportJob |
Must match the Job Name to be set when scheduling the jobUsing the original batch chain name overwrites the default settings |
| Batch Chain | BatchBalanceExportJob |
The name of the batch chain to be executed |
| Parameter 1 | Period = 3 |
Sets the period to the past 3 days |