Salesforce-B2C-Commerce-Cloud-Developer Practice Test

Salesforce Spring 25 Release
202 Questions

A developer configures the dw.json file and needs to fill in the necessary parameters to complete the task.
Which threeparameters are required when using npm scripts?
Choose 3 answers

A. Usemame/Password

B. Code Version

C. Hostname

D. Site ID

E. CSRF Token

B.   Code Version
C.   Hostname
D.   Site ID

Explanation:

When configuring the dw.json file for use with npm scripts in Salesforce B2C Commerce, the required parameters are B. Code Version, C. Hostname, and D. Site ID. These settings enable the npm scripts (e.g., upload, deploy) to connect to the correct instance, target the appropriate site, and use the specified code version for deployment or other operations.

Reasoning:
dw.json Configuration: The dw.json file is used by the B2C Commerce CLI (via npm scripts) to define connection and deployment settings for interacting with a sandbox or instance.

Required Parameters:
B. Code Version: Specifies the code version (e.g., version1) to deploy or activate. This is mandatory to ensure the correct codebase is used during operations like npm run deploy.
C. Hostname: Defines the instance hostname (e.g., dev01-001.demandware.net) to connect to the B2C Commerce environment. This is essential for establishing the API connection.
D. Site ID: Identifies the target site (e.g., RefArch or SiteGenesis) for the operation. This is required to scope the deployment or action to the correct site.
Example dw.json:
{
"hostname": "dev01-001.demandware.net",
"code-version": "version1",
"site-id": "RefArch",
"username": "admin",
"password": "password"
}

Optional Parameters:
A. Username/Password: These are used for authentication but are not always required if credentials are managed separately (e.g., via environment variables or a credentials file). They are optional in dw.json if other authentication methods are configured.
E. CSRF Token: This is not a parameter in dw.json; it’s an internal security token used during API requests but handled automatically by the CLI, not manually specified.

Reference:
Salesforce B2C Commerce Documentation: CLI Configuration lists required and optional dw.json parameters.
Trailhead Module: “B2C Commerce Developer” module on “Development Tools” covers npm script setup.

Exam Tip:
For the Salesforce B2C-Commerce-Developer exam, know that dw.json requires hostname, code-version, and site-id for npm script operations. Be cautious of distractors like CSRF Token (not configurable) or Username/Password (optional).

Salesforce-B2C-Commerce-Cloud-Developer Practice-Test - Home Previous
Page 30 out of 202 Pages