Skip to main content

Get to Know B2C Commerce Jobs

Learning Objectives

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

  • List three reasons for creating a job.
  • Describe the advantages of using the new job framework.
  • Explain important job concepts: flows, scope, locks, and schedules.
  • Explain what makes a job successful.

Introduction

Linda Rosenberg is a new administrator at Cloud Kicks, a high-end sneaker company. Linda has picked up a lot of Salesforce B2C Commerce skills lately that help her manage the Cloud Kicks storefront. This week she wants to learn how to set up complicated administrative processes that combine multiple tasks. The best tool for this is the B2C Commerce jobs capability, where she can schedule tasks that:

  • Automate import and export
  • Replicate data or code
  • Build a search index
  • Perform custom tasks

Linda Rosenberg, Administrator

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 Linda creates jobs, she can use out-of-the-box system job steps that don’t require any coding. If there isn’t a system step available to do what she wants, she can ask a developer to write a custom job step.

These are some typical reasons for using 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 software system so that a shopper calling a customer service representative (CSR) gets the same promotions as they would online.

Catalog

Perform special catalog exports for tax systems, so that the tax software knows what the product type is 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 display the current storefront price for products.

Order

Perform custom order exports. Some order management systems don’t understand the B2C Commerce order.xml requirements. Feed files must be custom made and transferred.

Let's get started.

New Jobs Framework

Linda noticed that some job functionality in Business Manager is labeled as deprecated.

  • Jobs (Deprecated)
  • Job History (Deprecated)

These options are for an older B2C Commerce job framework that she can still use to manage legacy jobs. However, there’s a new-and-improved job framework, and she wants to use it for new jobs. Here are some advantages of the new job framework.

  • You can use out-of-the-box system steps that require no coding.
  • Developers can create custom job steps using their preferred IDE to write a CommonJS module.
  • You can use flows to set up parallel execution of job steps.
  • You can start and monitor jobs using Open Commerce API (OCAPI).
  • You can monitor the progress of jobs in Business Manager.

Sound good? Linda thinks so, too! She wants to learn how to use this new job framework.

Important Job Concepts

Before she can plan and create jobs, Linda needs to understand these key concepts.

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

Job Flows

A job flow controls the sequence in which B2C Commerce executes job steps. Every job must contain at least one flow. Each flow must contain at least one job step.

Linda can configure sequential flows, which execute one after the other. In the Business Manager user interface, sequential flows take up the width of the page (1) and execute in the order shown, from top to bottom.

To access Business Manager, you must have a B2C Commerce implementation. In this module, we assume you are a B2C Commerce administrator with the proper permissions to perform these tasks. If you’re not a B2C Commerce administrator, that’s OK. Read along to learn how your administrator would take these steps in a sandbox instance. Don't try to follow our steps in your Trailhead Playground. B2C Commerce isn't available in the Trailhead Playground. If you have a sandbox instance of B2C Commerce, you can try out these steps in your instance. If you don't have a sandbox instance, ask your manager if there is one that you can use.

Job Steps page, with a sequential flow called out

Linda can also configure sibling flows, which execute in parallel. Business Manager displays sibling flows next to each other (1).

Jobs Steps page, with a set of four sibling flows called out

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

If there aren’t enough resources available, B2C Commerce executes sibling flows sequentially, even if she configures them to run in parallel. Also, certain job steps don’t support parallel execution, so they’re always executed sequentially even if Linda configured the flow that contains them as a parallel sibling flow. For example, B2C Commerce always sequentially executes the ExecutePipeline system step that supports the execution of legacy pipelines to avoid database conflicts.

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

Using sibling and sequential flows, Linda can configure jobs that have multiple flows that rejoin 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 that download price files, followed by another sequential flow that imports the price files. This job can finish with a sequential flow that reindexes and replicates to production.

The following illustration shows what happens when Linda configures three flows.

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

Job Flow Scope

Linda must assign every flow to a scope. Scope can be either the entire organization or one or more sites. By default, flows execute for the organization. Some job steps are only valid with a certain scope. For example, index rebuilding requires a site-level scope and can’t run under an organization scope.

Job Locks

When Linda sets up a job, she can assign certain resources to it. While the job is executing, B2C Commerce locks that resource and she and other users can’t modify it while the job is acting on it. This preserves data integrity and prevents data conflicts.

Job Schedules

Linda can 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 it's important for her to understand how long a job takes to execute before scheduling it. It’s also important that she schedule jobs so that multiple jobs don’t try to acquire a lock on the same object at the same time.

Typically, she can run as many as 15 jobs simultaneously.

Modes

What is job success with B2C Commerce? Simply, it means that B2C Commerce executed the job without error and the data ended up exactly where it was supposed to and how it was supposed to—as in, completely reindexed and ready for storefront search. If a job fails, it’s possible that B2C Commerce completed only a portion of the new data transfer, and the result is a mix of old and new data. That’s “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 disables jobs for disabled sites or sites that are in the process of being deleted; disabled jobs do not appear in the job history. B2C Commerce does not execute schedules on sandbox instances.

Next Steps

In this unit, Linda learned when to use jobs and the advantages of the new job framework. She also learned some important job concepts including flows, locks, scope, and schedule. Plus, she learned about what makes a job successful. Next, she learns about job steps.

Resources

Condividi il tuo feedback su Trailhead dalla Guida di Salesforce.

Conoscere la tua esperienza su Trailhead è importante per noi. Ora puoi accedere al modulo per l'invio di feedback in qualsiasi momento dal sito della Guida di Salesforce.

Scopri di più Continua a condividere il tuo feedback