Custom job steps: task and chunk modules
How to build a custom job step type: register it in steptypes.json, choose a task-oriented or chunk-oriented CommonJS module, control the exit status, read step parameters, keep transactions and memory in check, and configure the job's schedule and resource locks in Business Manager.
Given a business requirement to perform a scheduled task, develop jobs and code job scripts.
~8 min read · 13 practice questions ·
What the exam expects
- Create a custom job step type: CommonJS module,
steptypes.jsonin the cartridge root, cartridge on the path. - Choose a task-oriented or chunk-oriented module and implement its required functions.
- Predict a step's status code, error flag and whether the job continues from what the module returns or throws.
- Read step parameters in code and set step type attributes such as
transactionalandtimeout-in-seconds. - Configure the job in Business Manager (schedule, flows, resource locks) and write job code that scales.
Key terms: step type (a reusable step definition registered by a steptypes file); task-oriented module (one function runs the whole step); chunk-oriented module (read, process and write items in chunks of a set size); exit status (the dw.system.Status code and error flag the framework records for a step); job resource (an object a job locks while it runs).
Key facts
- Detail
- Cartridge root; one per cartridge
@type-id prefix- Detail
- Must begin with
custom.
@type-id on the path- Detail
- The step isn't loaded
function- Detail
- Module must export
execute
- Detail
read,process,write;chunk-sizerequired
process returns nothing- Detail
- Item is filtered from the write list
- Detail
- Always OK or ERROR
- Detail
- Code replaced with ERROR; job stops
transactional default- Detail
false
timeout-in-seconds- Detail
- No default; setting one is recommended
- Detail
parameters.NameorstepExecution.getParameterValue('Name')
- Detail
- Add the changed objects on the job's Resources tab
- Detail
- Organization / Sites; ExportOrders takes at most 1000 orders per run
Sources for this section (5)
- Create Custom Job Stepsdeveloper.salesforce.com (opens in a new tab)
- Class JobStepExecutiondeveloper.salesforce.com (opens in a new tab)
- Create and Configure B2C Jobstrailhead.salesforce.com (opens in a new tab)
- Job Step ImportCatalogsalesforcecommercecloud.github.io (opens in a new tab)
- Job Step ExportOrderssalesforcecommercecloud.github.io (opens in a new tab)
- Why give a chunk module a
getTotalCountfunction? - When one cartridge's steptypes.json has a syntax error, what happens to other cartridges' step types?
- Which names can a
@type-idnever take, apart from duplicates? - When should a recurring job's start date be set in the past?
The questions are free to read. Answers with their sources and self-grading are included with the pack.
Keep reading with the B2C Commerce Developer pack
- Core concepts
- Exam traps
- Worked scenario
The pack includes:
- All 28 lessons of the B2C Commerce Developer guide, with reading progress
- Interactive decision walks and step-by-step sequence steppers
- Practice exams purchase adds inline bank questions and topic practice (13 questions for this lesson)
- An official source cited for every claim
- An AI tutor that answers from the guide
- Choose guide-only, practice-only, or save $4 with both