Salesforce certification · Exam Salesforce-B2C-Commerce-Developer

Salesforce-B2C-Commerce-Developer Mock Exam

Salesforce B2C Commerce Developer

Free Salesforce-B2C-Commerce-Developer questions on Application Development, each with the answer and an explanation.

20 questions · 30 minutes · free, no sign-up

Application Development questions

1–10 of 15 free
Question 1 Choose 1
A developer is asked to create a controller endpoint that will be used in a client-side AJAX request. Its purposes is to displayupdated information to the user when the request is completed, without otherwise modifying the appearance of the current page.
According to SFRA practices, which method best supports this objective?
Show answerHide answer

Correct answer: A res.json()

Explanation

Explanation:

Why This Answer Is Correct
The requirement is classic for an AJAX endpoint: a client-side JavaScript request expects structured data (JSON) in response, which it will use to update the page dynamically without a full refresh. The res.json() method in SFRA (inherited from Express.js) is specifically designed for this purpose. It sets the correct Content-Type header to application/json and sends a JSON response. The developer can pass a JavaScript object to res.json(), which will be automatically serialized. This is the standard, clean, and efficient method for API endpoints that serve data to client-side logic. It aligns perfectly with the goal of providing “updated information” in a machine-readable format for JavaScript to process.

Why the Other Options Are Incorrect

B. res.render()
res.render() is used to process an ISML template and send the resulting HTML to the client. It is the standard method for rendering full or partial page views. Using it for an AJAX endpoint would be inefficient and inappropriate, as it would return HTML markup instead of lightweight JSON data. The client-side AJAX handler would then need to parse the HTML to extract data, which is cumbersome and brittle.

C. res.print()
res.print() (or Response.print() in the legacy DWScript API) is a low-level method that writes a raw string to the response stream. It does not set the Content-Type header to application/json. To use it for JSON, a developer would have to manually call JSON.stringify() on an object and then set the content type header, which is more verbose and error-prone than using the dedicated res.json() helper. It is not the best practice in the SFRA context.

Reference
SFRA Controller API Reference: Response Wrapper — Documents the res.json() method as the preferred way to send JSON responses.
Express.js API Documentation: res.json() — Underpins the SFRA implementation.
Question 2 Choose 1
A Storefront is designed so that multiple pages share a common header and footer layout.
Which ISML tag should a developer use on the templates for these pages to avoid code repetition in the most effective way
Show answerHide answer

Correct answer: A < isdecorate > …< / isdecorate >

Explanation

Explanation:

The <isdecorate> tag is the standard B2C Commerce solution for Template Decoration (also known as a Master Page or Wrapper pattern).

Instead of copying the header and footer code into every page template, you create one "decorator" template (e.g., pt_storefront.isml) that contains the common layout. Every other page template then "wraps" its unique content inside an <isdecorate template="path/to/decorator"> tag. When the page renders, the platform inserts the content from the page into the decorator's <isreplace/> tag. This ensures that a change to the header or footer only needs to be made in one file, satisfying the requirement to avoid code repetition effectively.

Why the Incorrect Answers are Wrong

B. iscontent: This tag is used to set the MIME type (e.g., text/html) and caching of the page. It does not handle layout sharing.

C. isreplace: This tag is used inside the decorator template to mark the spot where the content should be injected. It is not used on the "pages" themselves to share the layout.

D. isinclude: While <isinclude> can be used to bring in a header or footer, it is less effective for full-page layout management. Using isdecorate allows the layout to "own" the structure, making it much easier to manage complex nested layouts.

References
Salesforce Developers: ISML isdecorate Element
Template Composition with ISML
Question 3 Choose 1
A developer wants to embed a link to a content page from within the body of another content asset. the target content asset ID is: about-us
Which option represents the correct formatto use?
Show answerHide answer

Correct answer: A $url(''page-Show,''cid'', about-us')$

Explanation

Explanation:

In Salesforce B2C Commerce, the $url() function is used in ISML templates to generate URLs dynamically. This function is commonly used to create links to pages, content assets, or other resources within the platform. To link to a content asset, the $url() function requires specific parameters:

Action: Specifies the type of page or resource being linked to.
Parameters: Key-value pairs that provide additional context, such as the content ID (cid).

The correct syntax for linking to a content asset uses the Page-Show action, with the cid parameter specifying the content asset ID.

Option Analysis:

A. $url('Page-Show', 'cid', 'about-us')$
Action: Page-Show is the correct pipeline action used to display content assets in Salesforce B2C Commerce.
Parameters: The cid parameter is used to specify the content asset ID, which in this case is about-us. The syntax follows the standard format for the $url() function, where parameters are provided as key-value pairs.
Correctness: This option correctly formats the URL to point to the content asset with the ID about-us. The syntax is valid and adheres to the platform’s conventions.

B. $url('Content_Show', 'about-us')$
Action: Content_Show is not a valid pipeline action in Salesforce B2C Commerce for rendering content assets. The correct action is Page-Show.
Parameters: The syntax here is incorrect because it does not specify the cid parameter explicitly. The $url() function expects parameters in key-value pairs (e.g., 'cid', 'about-us'), not just a single value.
Correctness: This option is incorrect due to the invalid action and improper parameter syntax.

C. $url('Content-Page', cid 'about-us')$
Action: Content-Page is not a valid pipeline action in Salesforce B2C Commerce. The correct action is Page-Show.
Parameters: The syntax cid 'about-us' is invalid. The $url() function requires parameters to be enclosed in single quotes and provided as key-value pairs (e.g., 'cid', 'about-us'). Additionally, the semicolon and missing comma make this syntactically incorrect.
Correctness: This option is incorrect due to the invalid action and malformed syntax.

Why Option A is Correct:
The Page-Show pipeline is used to render content assets in Salesforce B2C Commerce.
The cid parameter is the standard way to specify the content asset ID (in this case, about-us).
The syntax $url('Page-Show', 'cid', 'about-us')$ follows the correct format for the $url() function, which takes the form $url('action', 'param1', 'value1', 'param2', 'value2', ...).

Reference:
Salesforce B2C Commerce Documentation: The official Salesforce B2C Commerce Developer Guide explains the use of the $url() function in ISML templates. Specifically, the Page-Show pipeline with the cid parameter is used to link to content assets. You can find details in the ISML Functions section of the Salesforce B2C Commerce Documentation (available on the Salesforce Help Portal).

Content Asset Linking: The documentation for content assets in B2C Commerce specifies that content assets are accessed using the Page-Show pipeline with the cid parameter. For example, see the Content Management section in the B2C Commerce Developer Guide.

Trailhead: Salesforce Trailhead modules, such as "B2C Commerce Content Management," provide practical examples of linking to content assets using ISML templates.
Question 4 Choose 1
A developer is using logging in scripts to troubleshoot an issue. They are using thedw.system.Log class to write to specific log levels and categories. Which log level is always enabled by default?
Show answerHide answer

Correct answer: A FATAL

Explanation

Explanation:

In Salesforce B2C Commerce (SFCC), the dw.system.Log class (accessed via Logger.getLogger() or convenience methods on Logger) is used to write messages at different log levels: FATAL, ERROR, WARN, INFO, and DEBUG. These levels follow a standard severity hierarchy where FATAL is the highest severity and DEBUG is the lowest.

A key platform behavior is that FATAL-level logging is always enabled by default across all environments, including production, staging, development, and sandboxes. This is intentional design by Salesforce to ensure that critical, system-threatening events (e.g., unrecoverable errors, severe exceptions, or fatal application failures) are always captured in the log files for debugging and monitoring purposes, even if no custom logging configuration has been applied.

Detailed behavior of log levels in SFCC:
FATAL — Always enabled and written to disk (appears in customfatal-*.log files in WebDAV). No configuration is needed to guarantee these messages are logged.
ERROR — Enabled by default in most environments, but can be disabled in custom log settings if explicitly unchecked in Business Manager → Administration → Operations → Custom Log Settings → Log Files section.
WARN — Enabled by default in production-like environments, but configurable.
INFO — Disabled by default in production for custom logs (to avoid excessive logging), but can be enabled manually.
DEBUG — Always disabled for file-based logging in production (to prevent performance impact); in non-production, it uses in-memory logging for the Request Log tool and is only written to disk if explicitly enabled.

Because FATAL messages represent the most severe issues that could indicate data corruption, security problems, or complete system failure, Salesforce ensures they are never suppressed—even if a developer has not touched the Custom Log Settings at all. This is why option A is correct.

Why not the other options?
B. INFO → INFO is not always enabled by default. In production, INFO-level messages to custom logs are disabled to prevent log file bloat (limited to 10 MB/day per server). They must be explicitly enabled via Custom Log Settings.
C. ERROR → ERROR is enabled by default in most configurations, but it is not guaranteed to be always enabled. A developer or administrator could disable ERROR logging in Custom Log Settings (though this is rare and not recommended). FATAL, however, cannot be disabled.

Best Practice Note:
When troubleshooting in scripts, developers should prefer FATAL or ERROR for critical issues that require immediate attention, WARN for recoverable problems, and INFO/DEBUG only in development/non-production for detailed tracing. Always check Custom Log Settings in Business Manager to confirm which levels are actually being written to disk.

References:
Salesforce B2C Commerce Documentation: Log Files Overview → States: "The fatal log level is always enabled on all instances."
Salesforce Help: Custom Log Settings → Confirms that FATAL messages are always written, regardless of configuration checkboxes.
SFCC Script API Reference: dw.system.Logger → Describes log levels and notes the special treatment of FATAL.
Trailhead Module: Performance Analysis and Logging in B2C Commerce – Reinforces that FATAL is the only level guaranteed to be always active.
Question 5 Choose 1
Multiple shoppers report slow performance on theProduct Details Page.
Which tool can a developer use to view average response times for the Product-Detail controller route?
Show answerHide answer

Correct answer: A Pipeline Profiler

Explanation

Explanation:

Why URL Request Analyzer Is Correct:
The URL Request Analyzer is designed specifically to:
- Measure average, minimum, and maximum response times
- Break down requests by controller route
- Analyze real storefront traffic
- Identify performance bottlenecks
It is the only tool that provides aggregated timing metrics per route, which is exactly what the question asks for.

Why the Other Options Are Incorrect:
❌ A. Pipeline Profiler
Pipeline Profiler (legacy) is not designed for aggregate performance metrics and is deprecated in SFRA.

❌ B. Request Logs
Request logs show individual request entries, not averages or trends. They are useful for debugging, not performance analysis.

Key Takeaway:
Use URL Request Analyzer to measure real-world performance metrics per controller route.

References:
URL Request Analyzer
Question 6 Choose 1
A developer observed a specific issue in production, which they cannot reproduce in other environments. The developer wants todo a hot fix to one of the ISMLpages, which uses tag, to see if that resolves while issue. Which consideration must the developer keep in mind while deploying the hot fix in production?
Show answerHide answer

Correct answer: C The TTL cache setting only affects static content and not the page cache, which could potentially cause he production issue.

Explanation

Explanation:

When deploying a hotfix to an ISML page in Salesforce B2C Commerce (SFCC), especially one that uses the < iscache > tag, you must consider the page caching mechanism.

If a page is cached (either fully or partially), any changes you make to the ISML file won’t take effect immediately in production unless you invalidate the cache.

🔍 Why Option A is Correct:
"It will be required to invalidate the cache for the hot fix."
✅ True
SFCC caches pages and templates aggressively in production for performance.
If the ISML page is cached using , then even after you deploy the updated template, the cached version might still be served.

You must either:
Manually invalidate the page cache via Business Manager or
Deploy with a code version change and trigger automatic cache invalidation
➡️ Failing to invalidate cache means your hotfix won’t be reflected immediately, making troubleshooting ineffective.

❌ Why the Other Options Are Incorrect:
B. "If the page has multiple tags, the highest cache duration is used" ❌ Not accurate.
Cache scope and duration are defined per tag — it doesn’t combine or inherit from others globally.
The final caching behavior depends on the outermost scope or how the template is included.

C. "TTL only affects static content, not the page cache" ❌ Misleading.
TTL (Time-To-Live) defined in does affect page cache.
It's used to determine how long a rendered template stays in the cache before expiring.
So yes, it can absolutely affect dynamic ISML behavior, which may be the root cause of the issue.

📘 Reference:
ISML < iscache > Tag Documentation
Cache Invalidation Guide
Question 7 Choose 1
Which line of code should a developer add for custom category debug logging?
Show answerHide answer

Correct answer: C Logger.getLogger( " contact " ).debug( " Contact service responded with OK. " );

Explanation

Explanation

In Salesforce B2C Commerce (SFCC) server-side JavaScript, the correct way to obtain a logger instance for a custom category is through the Logger.getLogger() static method on the dw.system.Logger class. You pass a category name (a string) to identify the log source, then call the appropriate log-level method (.debug(), .info(), .warn(), .error(), etc.) on the returned Logger instance.

Why the Other Options Are Incorrect

A. Logger.customLogger('contact').debug("Contact service responded with OK.");
– There is no customLogger() method on the dw.system.Logger class. This method does not exist in the SFCC Script API, so this line would throw a runtime error. It is a distractor that sounds plausible but is fabricated.

B. Logger.debug('Contact service responded with OK.');
– debug() is an instance method, not a static method. You cannot call it directly on the Logger class. You must first obtain a logger instance via getLogger(), getRootLogger(), or a similar factory method. Additionally, this line does not specify any custom category, so it fails the "custom category" requirement.

Reference

Salesforce B2C Commerce Script API documentation — Logger class, specifically the getLogger(String category) static method and instance-level logging methods (debug, info, warn, error, fatal). Also see Salesforce B2C Commerce documentation on Logging and Log Center for custom log categories in Business Manager.
Question 8 Choose 1
What is the correct format to use for embedding a link to a content page?
Show answerHide answer

Correct answer: B < a href= " ${URLUtils.url( ' Page-Show ' , ' cid ' , ' about-us ' )} " > About Us < /a >

Explanation

Explanation:

In Salesforce B2C Commerce (SFCC), content assets and content pages are rendered through the Page-Show controller endpoint. The URLUtils.url() helper builds a URL to a given controller route, and you must pass the correct route name followed by the parameter name/value pairs.

Why the Other Options Are Incorrect:

A. ${URLUtils.url('Content-Show', 'about-us')}
– There is no Content-Show controller route in the SFCC reference architecture. This route name does not exist, so the URL would not resolve to a valid endpoint. It also passes the content ID as a positional argument without the required cid parameter name, which is incorrect usage.

C. ${URLUtils.url('Content-Page', 'cid', 'about-us')}
– There is no Content-Page controller route in the SFCC reference architecture. This route name is fabricated. While the parameter format ('cid', 'about-us') is correct, the route name itself is wrong, so the link would fail.

Reference:

Salesforce B2C Commerce Script API documentation — dw.web.URLUtils class, specifically the url() method. Also see the SFCC reference architecture (SFRA / SiteGenesis) controller documentation for the Page-Show route and content asset rendering.
Question 9 Choose 1
How should a developer set up the files before making required edits to the address form?
Show answerHide answer

Correct answer: B Create a new sub-folder in the forms folder. Name iten_US. Copy existingaddress.xmlfile in the new folder.

Explanation

Explanation:

In Salesforce B2C Commerce (SFCC), form definitions are XML files stored under the forms folder within a cartridge. The address form is defined in a file named address.xml. To customize a form for a specific locale, you must create a locale-specific sub-folder named after the locale (e.g., en_US) inside the forms folder, and then place a copy of the address.xml file in that sub-folder.

This allows the developer to edit the en_US/address.xml file to modify the address form specifically for the en_US locale, without affecting the default form used by other locales. SFCC automatically resolves the correct form definition based on the active locale.

Why the Other Options Are Incorrect:

A. Create a copy of existing address.xml file in the default folder. Rename that file to address_en_US.xml.
– SFCC does not use a filename-based locale suffix convention like address_en_US.xml. Locale-specific form definitions are resolved by folder structure (a locale-named sub-folder), not by renaming the file. Placing a renamed file in the default folder would not be recognized as a locale-specific override.

C. Create a new sub-folder in the xmls folder. Name it en_US. Copy existing address.xml file in the new folder.
– Form definitions are not stored in an xmls folder. They belong in the forms folder. The xmls folder is not the correct location for form definitions, so this option would not work.

Reference:

Salesforce B2C Commerce documentation <— Forms (form definitions and XML form files). Also see the SFCC reference architecture (SFRA / SiteGenesis) documentation on customizing forms and locale-specific form overrides.
Question 10 Choose 1
A developer is asked to periodically create a CSV file in a WebDAV folder to hold the orders information of the last 30 days. What are the appropriate actions to implement such a requirement?
Show answerHide answer

Correct answer: A Develop and configure a steptype and corresponding CommonJS job step script.

Explanation

Explanation

In Salesforce B2C Commerce (SFCC), scheduled batch processing — such as periodically generating a CSV file and writing it to a WebDAV folder — is implemented using the Job framework. A job is made up of one or more steps, and each step is defined by a steptype. The steptype maps to a CommonJS job step script that contains the actual logic.

Why the Other Options Are Incorrect

B. Implement and configure a recurring task using the cron command in Business Manager.
– SFCC does not provide a general-purpose "cron command" feature in Business Manager for developers to schedule arbitrary recurring tasks. Scheduling in SFCC is done through the Job framework (job schedules), not by writing cron commands. While jobs can run on a schedule (which internally uses time-based triggers), the developer does not "use the cron command" — they configure a job schedule. This option misrepresents how scheduling works in SFCC.

C. Configure a new custom OCAPI endpoint and use the Customers resource type.
– OCAPI (Open Commerce API) is a REST API for external integrations, not a mechanism for periodically generating files on the server. It also does not run on a schedule on its own, and the Customers resource type is unrelated to orders or to writing CSV files to WebDAV. This option conflates an external API integration with an internal scheduled batch job and uses the wrong resource type.

Reference

Salesforce B2C Commerce documentation — Jobs (job framework, steptypes, job step scripts, and job scheduling) and dw.io package (File, FileWriter, CSVStreamWriter) for WebDAV file operations.
Full mock exam

Sit the Salesforce-B2C-Commerce-Developer exam before exam day

Full-length mocks with the same number of questions and the same time limit as the real Salesforce-B2C-Commerce-Developer exam. Every attempt draws a new set of questions from the full bank, so you can keep going until you pass comfortably.

Get full Salesforce-B2C-Commerce-Developer mock exam
  • —questions per mock
  • —time limit
  • 154questions in the bank
  • Newmock on every attempt