Skip to main content
Trailblazer Community 现已在 Slack 开启公开测试版。欢迎加入并实时交流。加入 Slack

Get to Know B2C Commerce Jobs

Learning Objectives

After completing this unit, you’ll be able to:

  • List three reasons for creating a job.
  • Explain important job concepts: flows, scope, locks, and schedules.
  • Explain what makes a job successful.

B2C Commerce Jobs in Business Manager is designed to help you manage and automate various tasks within your Salesforce B2C Commerce environments. Use B2C Commerce Jobs to create, schedule, and monitor jobs that perform a wide range of functions, from data imports and exports to custom script executions and system maintenance tasks.

Key features of B2C Commerce Jobs include:

  • Job Configuration: Define the steps and parameters for each job, specify tasks and their order.
  • Scheduling: Set up jobs to run at specific times or intervals. This makes sure that the job performs routine tasks automatically without manual intervention.
  • Monitoring and Management: Track the status of jobs, view logs, and manage job executions directly from the Business Manager interface.
  • Error Handling: Configure error handling and notifications to promptly address issues and minimize disruptions to your operations.
  • Reusable Steps: Use the IncludeStepsFromJob feature to incorporate steps from existing jobs, which promotes consistency and efficiency in job configurations.

B2C Commerce Jobs is essential for maintaining the smooth operation of your ecommerce platform, enabling you to automate repetitive tasks, ensure data integrity, and optimize system performance.

Define Jobs and Their Uses

A B2C Commerce job is a set of steps that perform long-running operations such as downloading an import file or rebuilding a search index. When you create jobs, you use out-of-the-box system job steps requiring no coding. If a system step is unavailable for what you want to do, ask a developer to write a custom job step.

Here are some typical reasons to use jobs.

Data

Application

Customer

Export customer records to an external system such as Marketing Cloud Engagement.

Promotion

Export promotion data to an external customer service system so a shopper calling a customer service representative (CSR) gets the same promotions as they do online.

Catalog

Perform special catalog exports for tax systems, so the tax software knows the product type to calculate the correct tax. For example, in the US, Massachusetts doesn’t tax apparel under a certain price, but does tax electronics.

Catalog

Perform special catalog exports for Google Merchant, so Google search results show the current storefront price for products.

Order

Perform custom order exports. Some order management systems understand the B2C Commerce order.xml requirements. Feed files are custom-made and transferred.

Recall Important Job Concepts

Before you plan and create jobs, understand these key concepts.

  • Job flows
  • Job scope
  • Job locks
  • Job schedules

Distinguish Job Flows

A job flow controls the sequence in which B2C Commerce runs job steps. Every job contains at least one flow. Each flow contains at least one job step.

You can configure sequential flows, which run one after the other. In the Business Manager user interface, sequential flows take up the width of the page and run from top to bottom.

You can also configure sibling flows, which run in parallel. Business Manager shows sibling flows next to each other.

Sibling flows run simultaneously as long as system resources are available. If parallel execution isn’t feasible, for example, when multiple parallel steps access external resources at the same time, you can configure sibling flows to run sequentially. Sequential sibling flows run from left to right.

If there aren’t enough resources available, B2C Commerce runs sibling flows sequentially, even if you configure them to run in parallel. Also, certain job steps don’t support parallel execution, so they always run sequentially even if you configure the flow containing them as a parallel sibling flow. For example, B2C Commerce always sequentially runs the ExecutePipeline system step supporting the execution of legacy pipelines to avoid database conflicts.

When you configure a sequential flow to run for more than one site (by using the scope setting, which you explore next), B2C Commerce runs the flow in parallel for the different sites, as long as enough system resources exist to accommodate parallel execution.

By using sibling and sequential flows, you configure jobs that have multiple flows rejoining into a single flow.

Here’s an example: Sibling parallel flows download catalog files, followed by a sequential flow that imports catalog files, followed by another set of sibling parallel flows downloading price files, followed by another sequential flow importing the price files. This job finishes with a sequential flow reindexing and replicating to production.

This illustration shows what happens when you configure three flows.

Two sequential sets of parallel flows complete, and then another sequential flow completes.

Assign Job Flow Scope

You assign every flow to a scope. There are four distinct scope options available.

  • Organization: Runs the flow for the entire instance.
  • Specific Sites: Targets only the storefronts that you select.
  • All Storefront Sites: Runs the flow on all available storefront sites, excluding the Business Manager site or any sites with a to-be-deleted status.
  • Site Parameter: Passes sites to the job at run time by using the OCAPI Data API.

Some job steps are only valid with a certain scope, so trying to assign a step to a flow with an unsupported scope generates an error. For example, a step that requires a site-level scope can’t run under an organization scope.

Apply Job Locks

When you set up a job, you assign certain resources to it. While the job runs, B2C Commerce locks that resource so that you and other users can’t modify it while the job acts on it. The lock preserves data integrity and prevents data conflicts.

Schedule Jobs

You run jobs manually or schedule them to run automatically at certain times and intervals. A job doesn’t start if a previous execution of the same job is still running, so you understand how long a job takes to run before scheduling it. It’s also important that you schedule jobs to avoid multiple jobs trying to acquire a lock on the same object simultaneously.

Note

You can’t schedule custom jobs to run on sandbox instances, you can only run them manually.

B2C system jobs run on schedule in sandboxes.

Evaluate Job Success and Failure Modes

Job success means that B2C Commerce completed the job without error and the data ended up exactly where it belongs. It also means that the data ended up how it belongs: reindexed, and ready for storefront search. If a job fails, B2C Commerce completely transfers only a portion of the new data, and the result is a mix of old and new data. That is "bad data."

What is job success and job failure?

Jobs fail for other reasons. You typically use jobs for mass data or long-running operations, which can fail due to network or power fluctuations.

Note

B2C Commerce automatically turns off jobs for disabled sites or sites in the process of being deleted. Disabled jobs don’t show in the job history.

Next Steps

In this unit, you learned when to use jobs and some important job concepts including flows, locks, scope, and schedule. Plus, you learned about what makes a job successful. Next, you learn about job steps.

Resources

在 Salesforce 帮助中分享 Trailhead 反馈

我们很想听听您使用 Trailhead 的经验——您现在可以随时从 Salesforce 帮助网站访问新的反馈表单。

了解更多 继续分享反馈