> For the complete documentation index, see [llms.txt](https://docs.digitalriver.com/salesforce-b2b/llms.txt). Markdown versions of documentation pages are available by appending `.md` to page URLs; this page is available as [Markdown](https://docs.digitalriver.com/salesforce-b2b/2.1.0/integrating-the-digital-river-salesforce-b2b-commerce-app/step-12-schedule-backend-jobs.md).

# Step 12: Schedule backend jobs

For the Salesforce B2B Commerce App to continuously synchronize data between Salesforce and Digital River, you need to schedule backend batch jobs. To schedule the backend jobs:

1. Click **Setup** ![](/files/-MRVrv14OLV-oqRNPKJF) and select **Developer Console** from the dropdown list. The Developer window appears. \
   ![](/files/-MRS2pVzg1HxTIScU2AW)
2. Click **Debug** and select **Open Execute Anonymous Window**. The Enter Apex Code dialog appears.\
   ![](/files/-MRS2x4PLD5WWtVztf7o)
3. Copy the script from the first row of the table under **Batch Job Scripts** and run it in the Developer console Anonymous window.
4. Repeat Step 3 for every script in the [batch job scripts table](/salesforce-b2b/2.1.0/integrating-the-digital-river-salesforce-b2b-commerce-app/step-12-schedule-backend-jobs.md#batch-job-scripts).

## Batch job scripts <a href="#batch-job-scripts" id="batch-job-scripts"></a>

The following table lists the jobs that you need to schedule and the apex code that you can run to set up the jobs. You can also find these settings on the Schedule Jobs tab in the DR CC Config Settings spreadsheet.

| Batch Job Name                            | Script to Schedule Batch Job                                                                                                                                                                                                                                                                                      | Comments                                                                                                                                                                                       |
| ----------------------------------------- | ----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- | ---------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- |
| Order Fulfillment Job                     | <p><code>// To run every 5 minutes</code> <br><code>for(Integer i=0; i<60; i=i+5) {</code> </p><p><code>String cronTrigger = '0 ' + i + ' \* \* \* ?';</code> </p><p><code>System.schedule('Order Fulfillment Job: ' + i, cronTrigger, new digitalriverv2.DRB2B\_ScheduleOrderLevel\_Fulfillment()); }</code></p> | This job sends Order Level Fulfillment Information to Digital River. Currently, this is used only for order cancellations.                                                                     |
| Line Item  Fulfillment Job                | <p><code>// Run Every 5 minutes</code> </p><p><code>for(Integer i=0; i<60; i=i+5){ String cronTrigger = '0 ' + i + ' \* \* \* ?'; System.schedule('Line Item Fulfillment Job: ' + i, cronTrigger, new digitalriverv2.DRB2B\_ScheduleLineItem\_Fulfillment());</code> </p><p><code>}</code></p>                    | This job sends line-item level fulfillment Information to Digital River.                                                                                                                       |
| CC Subscription Installment Processor Job | `Database.executeBatch(new ccrz.cc_batch_SubscriptionProcessor('DefaultStore', ccrz.cc_hk_Subscriptions.PARAM_CONTEXT_RECURR_INSTALL_ONLY, false));`                                                                                                                                                              | Schedule this job to run at least once every day.                                                                                                                                              |
| DR  Subscription Processor Job            | `//Schedule DR Subscription Processor Job every hour System.schedule('DR Subscription Processor Job, '0 0 * * * ?', new digitalriverv2.DRB2B_InstallmentSubscriptionProcessor());`                                                                                                                                | This job currently processes only 1 record at a time. Please schedule this more often in a day based on the number of installments that need to be processed.                                  |
| DCM Application Logs Cleanup Job          | <p><code>// Run once a day. You can configure this to run more often in lower environments where Logging Level might be set to DEBUG</code> <br><code>System.schedule('DCM Application Log Cleanup Job, '0 0 0 ? \* \* \*', new digitalriverv2.DCM\_ApplicationLogCleanupJob());</code></p>                       | This job cleans up the DCM Application logs based on the configuration “Delete Logs older than” in the Custom Metadata type **digitalriverv2\_\_DCM\_Application\_Log\_Configuration\_\_mdt**. |


---

# Agent Instructions
This documentation is published with GitBook. GitBook is the documentation platform designed so that both humans and AI agents can read, navigate, and reason over technical content effectively. Learn more at gitbook.com.

## Querying This Documentation
If you need additional information that is not directly available in this page, you can query the documentation dynamically by asking a question.

Perform an HTTP GET request on the current page URL with the `ask` query parameter, and the optional `goal` query parameter:

```
GET https://docs.digitalriver.com/salesforce-b2b/2.1.0/integrating-the-digital-river-salesforce-b2b-commerce-app/step-12-schedule-backend-jobs.md?ask=<question>&goal=<endgoal>
```

`ask` is the immediate question: it should be specific, self-contained, and written in natural language.
`goal` is optional and describes the broader end goal you are ultimately trying to accomplish on behalf of the user. GitBook uses it to tailor the answer towards what is most useful for that goal.

The response will contain a direct answer to the question and relevant excerpts and sources from the documentation.

Use this mechanism when the answer is not explicitly present in the current page, you need clarification or additional context, or you want to retrieve related documentation sections.
