Salesforce-B2C-Commerce-Cloud-Developer Practice Test Questions

202 Questions


A Digital Developer suspects a logical error in a script.
Which action will help locate the error?


A. Submit a support ticket to B2C Commerce.


B. Check request logs for evidence of the logical error.


C. Put breakpoints in the code, debug, and examine variable values.


D. Print all values in the script node called before the current script.





C.
  Put breakpoints in the code, debug, and examine variable values.

Explanation:

When a logical error is suspected in a Salesforce B2C Commerce script, the most effective way to locate and understand the issue is to:

Use the Script Debugger (available in sandbox environments).

Set breakpoints at key lines of code.

Step through execution to observe control flow and variable values.

Evaluate expressions to confirm whether logic behaves as expected.

This approach allows the developer to pinpoint exactly where the logic deviates from expectations — whether due to incorrect conditions, unexpected data, or flawed assumptions.

Why the other options fall short:

A. Submit a support ticket: Support can help with platform issues, but not with custom logic bugs in your code.

B. Check request logs: Useful for runtime errors or stack traces, but not ideal for tracing logic flow.

D. Print values in a previous script node: May help in pipelines, but doesn’t offer the precision or control of a debugger.

A Digital Developer is adding support for an additional language other than the default. The locale code for the new language is de.
In which folder should the developer place resource bundles?


A. templates/de


B. templates/default


C. templates/resources


D. templates/default/resources





D.
  templates/default/resources

Explanation:

In Salesforce B2C Commerce, resource bundles (like checkout.properties, account.properties, etc.) are used to localize text displayed in ISML templates. These bundles must be placed in the correct folder structure to support locale-specific overrides.

To support a new language with locale code de (German), the developer should:

Place the default resource bundle in: templates/default/resources/checkout.properties

Then, add a locale-specific override in: templates/default/resources/checkout_de.properties

This structure ensures that:

The system uses checkout_de.properties when the storefront locale is set to de.

If a key is missing in the German file, it falls back to the default checkout.properties.

Why the other options are incorrect:

A. templates/de: Not a valid location for resource bundles — used for templates, not localization.

B. templates/default: This is where ISML templates live, not resource bundles.

C. templates/resources: Missing the required default subfolder — not recognized by the framework.

A Digital Developer is tasked with setting up a new Digital Server Connection using UX Studio in their sandbox.
Which three items are required to accomplish this task? (Choose three.)


A. Instance Version


B. Instance Hostname


C. Business Manager Username


D. Keystore Password


E. Business Manager Password





B.
  Instance Hostname

C.
  Business Manager Username

E.
  Business Manager Password

Explanation:

When setting up a Digital Server Connection in UX Studio to connect your sandbox, you must provide credentials and connection details that UX Studio uses to authenticate and communicate with your Salesforce B2C Commerce instance.

B. Instance Hostname
This is the domain name or URL of your B2C sandbox (e.g., dev01-us01.sfcc.digital or xyz.sandbox.us01.dx.commercecloud.salesforce.com)

C. Business Manager Username
Your user ID for logging into Business Manager.

E. Business Manager Password
Password for the above user — used for authenticating UX Studio to the sandbox.

Why Not the Others?:

A. Instance Version
➤ UX Studio does not need the specific version of the instance. That info is used more for compatibility awareness, not for establishing the connection.

D. Keystore Password
➤ Keystore is used when setting up secure connections or certificates (e.g., for OCAPI or integrations), not for UX Studio sandbox login.

A Digital Developer has been given a specification to integrate with a REST API for retrieving weather conditions. The service expects parameters to be form encoded.
Which service type should the Developer register?


A. FTP


B. SOAP


C. HTTP Form


D. WebDAV





C.
  HTTP Form

Explanation:

When integrating with a REST API that expects form-encoded parameters (i.e., application/x-www-form-urlencoded), the appropriate service type in Salesforce B2C Commerce is:
HTTP Form
This service type:
Sends data using form encoding, which is common for legacy REST APIs or simple POST requests.
Automatically formats parameters as key-value pairs in the request body.
Is ideal for APIs that do not accept JSON or XML payloads.

Why the other options don’t work:

A. FTP: Used for file transfers — not suitable for API calls.

B. SOAP: Designed for XML-based web services — incompatible with REST and form encoding.

D. WebDAV: Used for remote file management — not for API integration.

Given a NewsletterSubscription custom object that has a key attribute named email of type String, what is the correct syntax to create the NewsletterSubscription custom object and persist it to the database?


A. Var customobject = dw.object.CustomObjectMgr.createNewsletterSubscription(‘email’, newsLetterForm.email.value);


B. Var customobject = dw.object.CustomObjectMgr.createCustomObject(newsletterForm.email.value, ‘NewsletterSubscription’)


C. Var customobject = dw.object.CustomObjectMgr. createCustomObject (‘NewsletterSubscription’, newsLetterForm.email.value);


D. Var customobject = dw.object.CustomObjectMgr. createCustomObject (‘NewsletterSubscription’,’email’, newsLetterForm.email.value);





C.
  Var customobject = dw.object.CustomObjectMgr. createCustomObject (‘NewsletterSubscription’, newsLetterForm.email.value);

Explanation:

To create and persist a custom object in Salesforce B2C Commerce, use:
CustomObjectMgr.createCustomObject(objectType, keyValue);

- objectType: The ID of the custom object type (e.g., "NewsletterSubscription")
- keyValue: The value for the key attribute (e.g., the email address)

Correct Syntax Example:
var CustomObjectMgr = require('dw/object/CustomObjectMgr');
var customObject = CustomObjectMgr.createCustomObject(
    'NewsletterSubscription',
    newsletterForm.email.value
);


Why Other Options Are Incorrect:

A. createNewsletterSubscription(...) — No such method exists.
B. createCustomObject(newsletterForm.email.value, 'NewsletterSubscription') — Incorrect argument order.
D. createCustomObject('NewsletterSubscription', 'email', newsletterForm.email.value') — Too many arguments. Method only accepts two.

Important:
Wrap custom object creation in a transaction:
var Transaction = require('dw/system/Transaction');
Transaction.wrap(function () {
    var customObject = CustomObjectMgr.createCustomObject('NewsletterSubscription', newsletterForm.email.value);
    customObject.custom.firstName = newsletterForm.fname.value;
    customObject.custom.lastName = newsletterForm.lname.value;
});

Which three operations should be done in a controller?
Choose 3 answers


A. Generate the response as JSON or HTML


B. Use the Script API to generate data for the view.


C. Use middleware functions when applicable


D. Create a plain JavaScript object representing a system object
Use the model needed for the view.





A.
  Generate the response as JSON or HTML

B.
  Use the Script API to generate data for the view.

C.
  Use middleware functions when applicable

Explanation:

In SFRA (Storefront Reference Architecture), controllers are responsible for handling HTTP requests and coordinating logic, middleware, and output.

A. Generate the response as JSON or HTML ✅
Controllers must return responses in HTML (via ISML templates) or JSON (for AJAX/API endpoints).
Example:
res.render('product/details');
res.json({ success: true });

B. Use the Script API to generate data for the view ✅
Controllers often use system objects and helper scripts (e.g., ProductMgr, OrderMgr) to fetch or manipulate data before passing it to the view.

C. Use middleware functions when applicable ✅
Middleware like server.middleware.https or csrfProtection is used to validate or secure requests.
Example:
server.get('Show', server.middleware.https, function (req, res, next) { ... });

D. Create a plain JavaScript object representing a system object ❌
This is incorrect. You should use platform APIs (like ProductMgr) to work with system objects, not create plain JS objects that simulate them.

E. Use the model needed for the view ❌
Models are typically defined in external helper files or model scripts. Controllers should import and use them, but not define or construct them inline.

Universal Containers has expanded its implementation to support German with a locale code of de. The current resource bundle is checkout.properties.
To which file should the developer add German string values?


A. checkout_de.properties in resources folder


B. checkout.properties in the de locale folder


C. checkout.properties in the default locale folde


D. de_checkout.properties in resources folder





A.
  checkout_de.properties in resources folder

Explanation:

Salesforce B2C Commerce uses locale-specific resource bundles to support internationalization. When adding support for German (de), the developer should:

Place the localized strings in a file named checkout_de.properties
Store this file in the same folder as the default bundle: templates/default/resources/

This naming convention ensures that when the storefront locale is set to de, the system automatically loads checkout_de.properties. If a key is missing, it falls back to checkout.properties.

Why the other options are incorrect:

B. checkout.properties in the de locale folder: B2C Commerce does not use locale-specific folders for resource bundles — it uses locale-specific filenames.

C. checkout.properties in the default locale folder: That’s the default bundle, not the German override.

D. de_checkout.properties: Incorrect naming convention — the locale code must follow the base name, not precede it.

Which three configuration does a developer need to ensure to have a new product visible in the
Storefront? Choose 3 answers


A. The product has a Price


B. The Storefront catalog that contains the product is assigned to a site


C. The product has a master product


D. The product is online and searchabl


E. The search index is built.
Tengo dudas con el A. REVISAR





B.
  The Storefront catalog that contains the product is assigned to a site

D.
  The product is online and searchabl

E.
  The search index is built.
Tengo dudas con el A. REVISAR

Explanation:

To make a product visible in the storefront, the developer must ensure three key configurations are in place:

Catalog Assignment
The product must be part of a storefront catalog that is assigned to the current site in Business Manager.

Online and Searchable Flags
The product should be marked as "Online" and "Searchable" so that it can be shown and found by customers.

Search Index
After adding or updating a product, the search index must be rebuilt to reflect the change and include the product in storefront searches.

Why A is not required
A price is essential for checkout and presentation, but it is not strictly required for visibility. A product with no price can still appear in search results.

Why C is not required
Only variation products require a master. Standard products do not need a master to be visible.

A Digital Developer is asked to optimize controller performance by lazy loading scripts as needed instead of loading all scripts at the start of the code execution.
Which statement should the Developer use to lazy load scripts?


A. importPackage () method


B. $.ajax () jQuery method


C. local include


D. require () method





D.
  require () method

Explanation:

In Salesforce B2C Commerce, the require() method is the correct way to implement lazy loading of scripts. This allows you to load a module only when it's actually needed during execution.

How require() Supports Lazy Loading:
- require() loads a script only when the line is executed.
- Improves controller performance by avoiding loading unused modules during initial execution.
- Can be placed inside route handlers or functions to defer loading.

Example:
server.get('Show', function (req, res, next) {
    var basketHelper = require('*/cartridge/scripts/helpers/basketHelper');
    basketHelper.processBasket();
    next();
});


Why Other Options Are Incorrect:
A. importPackage() – This is for the old Rhino engine and is not supported in CommonJS-based environments like SFCC.
B. $.ajax() – This is a client-side method for sending HTTP requests using jQuery; it has nothing to do with server-side script loading.
C. local include – This is used in ISML templates to include HTML markup or partials, not JavaScript modules.

Best Practice:
Use require() inside route callbacks or functions to load only what is needed, improving performance and reducing memory usage.

A job executes a pipeline that makes calls to an external system. Which two actions prevent performance issues in this situation? (Choose two.)


A. Use synchronous import or export jobs


B. Configure a timeout for the script pipelet.


C. Disable multi-threading.


D. Use asynchronous import or export jobs





B.
  Configure a timeout for the script pipelet.

D.
  Use asynchronous import or export jobs

Explanation

When a job integrates with an external system, it can suffer performance issues due to delays or blocking. Two key actions help reduce this risk:

Configure a Timeout for the Script Pipelet
Setting a timeout prevents the job from hanging indefinitely if the external system is slow or fails to respond.
This helps release resources, fail gracefully, and maintain system responsiveness.

Use Asynchronous Import or Export Jobs
Asynchronous jobs allow execution to continue without waiting on external systems.
They free up threads and avoid bottlenecks caused by synchronous processing.

Why A and C Are Incorrect
A. Synchronous jobs block operations, increasing the chance of performance issues.
C. Disabling multi-threading reduces concurrency and can hurt overall performance.

A merchant has a requirement to render personalized content to n a category page via a Content Slot that targets VIP high-spending customers during a specific promotional period.
Which two items should the developer create to achieve the specified requirements? Choose 2 answers:


A. VIP Customer Group


B. Page Template


C. Slot Configuration


D. Rendering Template





C.
  Slot Configuration

D.
  Rendering Template

Explanation:

To deliver personalized content to VIP customers during a promotional period, the developer should configure the following: Slot Configuration
Defines what content appears in the slot, when it appears, and under what conditions (e.g., customer group and time-based rules). This is where the developer sets up targeting for VIP customers and schedules the promotional content.

Rendering Template
Controls how the content is displayed within the slot. It can be customized to show banners, product carousels, or tailored messaging for high-spending users.

Why A and B are not required

VIP Customer Group
While this group is used in the slot configuration rules, it is typically created by merchandisers in Business Manager — not by developers.

Page Template
Not necessary for slot-based personalization. The slot can be embedded in existing templates without creating a new one.

Universal Containers wants to add a model field to each product. Products will have locale-specific model values. How should the Digital Developer implement the requirement?


A. Utilize resource bundles for translatable values.


B. Set the model field as a localizable attribute.


C. Store translated model values in different fields; one field for each locale.


D. Add model to a new custom object with localizable attributes.





B.
  Set the model field as a localizable attribute.

Explanation:

To support locale-specific model values on products in Salesforce B2C Commerce, you should configure the product attribute as localizable.

Why B is Correct:
- A localizable attribute allows different values for each site locale (e.g., en_US, de, fr).
- This is the standard method for storing translated or region-specific data like model numbers, names, or descriptions.
- Values can be set in Business Manager per locale or imported through catalog files.

Why Other Options Are Incorrect:

A. Utilize resource bundles – Resource bundles are meant for UI and template labels, not for dynamic product data like model values.
C. Store translated model values in different fields – This is inefficient, hard to maintain, and goes against best practices.
D. Add model to a custom object – Using a custom object adds unnecessary complexity. Product attributes should be stored directly on the product object.

How to Implement in Business Manager:

1. Go to Administration > System Object Types > Product
2. Add or edit the custom attribute (e.g., model)
3. Check the "localizable" option
4. Save and enter translated values in the appropriate locale contexts


Page 3 out of 17 Pages
Previous