home / skills / salesforcecommercecloud / b2c-developer-tooling / b2c-job

This skill lets you run and monitor existing B2C jobs with the b2c CLI, streamlining batch processing and log retrieval.

npx playbooks add skill salesforcecommercecloud/b2c-developer-tooling --skill b2c-job

Review the files below or copy the command above to add this skill to your agents.

Files (1)
SKILL.md
3.0 KB
---
name: b2c-job
description: Run and monitor existing (B2C/demandware/SFCC) jobs using the b2c cli, import/export site archives (IMPEX). Use when executing batch jobs, importing site data, running search indexing, checking job status, or viewing job logs. For creating new jobs, use b2c-custom-job-steps skill instead.
---

# B2C Job Skill

Use the `b2c` CLI plugin to **run existing jobs** and import/export site archives on Salesforce B2C Commerce instances.

> **Tip:** If `b2c` is not installed globally, use `npx @salesforce/b2c-cli` instead (e.g., `npx @salesforce/b2c-cli job run`).

> **Creating a new job?** If you need to write custom job step code (batch processing, scheduled tasks, data sync), use the `b2c:b2c-custom-job-steps` skill instead.

## Examples

### Run a Job

```bash
# run a job and return immediately
b2c job run my-custom-job

# run a job and wait for completion
b2c job run my-custom-job --wait

# run a job with a timeout (in seconds)
b2c job run my-custom-job --wait --timeout 600

# run a job with parameters (standard jobs)
b2c job run my-custom-job -P "SiteScope={\"all_storefront_sites\":true}" -P OtherParam=value

# show job log if the job fails
b2c job run my-custom-job --wait --show-log
```

### Run System Jobs with Custom Request Bodies

Some system jobs (like search indexing) use non-standard request schemas. Use `--body` to provide a raw JSON request body:

```bash
# run search index job for specific sites
b2c job run sfcc-search-index-product-full-update --wait --body '{"site_scope":["RefArch","SiteGenesis"]}'

# run search index job for a single site
b2c job run sfcc-search-index-product-full-update --wait --body '{"site_scope":["RefArch"]}'
```

Note: `--body` and `-P` are mutually exclusive.

### Import Site Archives

The `job import` command automatically waits for the import job to complete before returning. It does not use the `--wait` option.

```bash
# import a local directory as a site archive
b2c job import ./my-site-data

# import a local zip file
b2c job import ./export.zip

# keep the archive on the instance after import
b2c job import ./my-site-data --keep-archive

# import an archive that already exists on the instance (in Impex/src/instance/)
b2c job import existing-archive.zip --remote

# show job log on failure
b2c job import ./my-site-data --show-log
```

### Export Site Archives

```bash
# export site data using the job export command
b2c job export
```

### Search Job Executions

```bash
# search for job executions
b2c job search

# search with JSON output
b2c job search --json
```

### Wait for Job Completion

```bash
# wait for a specific job execution to complete
b2c job wait <execution-id>
```

### More Commands

See `b2c job --help` for a full list of available commands and options in the `job` topic.

## Related Skills

- `b2c:b2c-custom-job-steps` - For **creating** new custom job steps (batch processing scripts, scheduled tasks, data sync jobs)
- `b2c-cli:b2c-site-import-export` - For site archive structure and metadata XML patterns

Overview

This skill runs and monitors existing Salesforce B2C Commerce (Demandware/SFCC) jobs using the b2c CLI and handles import/export of site archives (IMPEX). It focuses on executing batch/system jobs, checking status, viewing logs, and moving site data between local and instance storage. Use this for operational tasks; for authoring new job step code use the custom-job-steps skill.

How this skill works

The skill invokes the b2c CLI commands to run jobs, optionally waiting for completion, passing parameters, or supplying raw JSON request bodies for system jobs. It uses the job import/export commands to push or pull IMPEX site archives and provides helpers to search executions, wait on execution IDs, and show logs when failures occur. If the b2c CLI is not globally installed, it supports running via npx.

When to use it

  • Run an existing batch job or system job (e.g., search indexing).
  • Import a local site archive directory or zip into a B2C instance.
  • Export site data from an instance to create an archive.
  • Check job execution status, search job history, and retrieve logs on failures.
  • Wait programmatically for job completion before continuing a deployment or pipeline.

Best practices

  • Use --wait and --timeout for long-running jobs to avoid orphaned executions.
  • Provide parameters with -P for standard jobs; use --body only for jobs that require raw JSON (they are mutually exclusive).
  • Use --show-log when runs fail to capture error details for troubleshooting.
  • Keep archives on the instance only when necessary (use --keep-archive sparingly).
  • Run the CLI via npx if the global b2c plugin is not installed to ensure consistent tooling version.

Example use cases

  • Run a nightly product indexing job and wait for completion before switching search traffic.
  • Import storefront content from a local export prior to a functional test run in a sandbox.
  • Export an instance archive to capture current site data before a major deployment.
  • Search recent job executions to diagnose intermittent failures and view their logs.
  • Trigger a system job (search index) with a custom site_scope JSON body for targeted reindexing.

FAQ

Can I run jobs if the b2c CLI isn’t installed globally?

Yes. Prefix commands with npx @salesforce/b2c-cli (for example npx @salesforce/b2c-cli job run) to run without a global install.

When should I use --body vs -P parameters?

Use -P for standard job parameters. Use --body only when the job expects a raw JSON request schema (system jobs like search indexing). They cannot be used together.