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:

Logical errors are flaws in program flow or business logic that produce incorrect results while the code still executes without syntax errors. The most effective way to locate these is through interactive debugging. B2C Commerce provides debugging tools in UX Studio and Business Manager Script Debugger that allow developers to:

- Set breakpoints at suspicious lines of code
- Step through execution line by line
- Inspect variable values at runtime
- Watch expressions evaluate in real-time
- Trace call stacks to understand execution flow

This approach directly addresses logical errors by revealing the actual state of the program versus expected state. For example, if a conditional statement isn't branching correctly, examining the variables at the breakpoint shows whether the condition evaluates as anticipated. Debugging provides definitive insight into runtime behavior that static code analysis or logging cannot match in efficiency.

Why Other Options Are Incorrect
A. Submit a support ticket to B2C Commerce – Support tickets are for platform issues, bugs, or outages, not for debugging custom code logic. Salesforce support won't analyze business logic errors in customer implementations.

B. Check request logs for evidence of the logical error – Logs may show symptoms (like incorrect data being processed) but rarely reveal the root cause of logical errors. Logical errors often produce valid-looking requests with wrong business outcomes that aren't logged as errors.

D. Print all values in the script node called before the current script – This is a primitive form of logging that could generate excessive noise. While sometimes useful, it's less efficient than targeted debugging and may not capture the exact moment the logical error occurs.

References
B2C Commerce Debugging Guide: "Using the Script Debugger"
UX Studio Documentation: "Debugging Techniques"
Salesforce Help Article: "Troubleshooting Logic Errors in Scripts"

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





C.
  templates/resources

Explanation:

In B2C Commerce, localized storefront text is typically stored in properties files known as resource bundles (template resource bundles). These are accessed from ISML via Resource.msg(...) and similar methods. For SFRA and many storefront implementations, the standard location for these bundles is the /templates/resources directory, and the locale is typically expressed in the filename suffix (for example account_de.properties, account_de_DE.properties), or through directory structure depending on the project pattern.

Salesforce Trailhead guidance for localizing storefront components explicitly describes storing resource bundles under /templates/resources and specifying locale codes in filenames (examples include account_en_US.properties). The dw.web.Resource API documentation also confirms that the platform loads locale-specific strings from resource bundles appropriate for the current locale. Therefore, to add German (de), the correct answer among the provided options is templates/resources, because that is where template resource bundles are stored and resolved.

The other listed directories either refer to template sets (templates/default) or to locale-specific template folders for ISML templates themselves — not the resource bundle location. Resource bundles are not placed in templates/default/resources as a standard pattern in SFRA; instead, resources are centralized in templates/resources and then differentiated by filename.

Why the other options are incorrect
A. templates/de — That resembles a locale template folder for ISML templates, not where .properties bundles go.
B. templates/default — This is where default-locale ISML templates reside, not resource bundles.
D. templates/default/resources — Not the documented standard location for template resource bundles in the modern pattern; you’d typically use templates/resources.

References
Trailhead: localize storefront components; resource bundles under /templates/resources with locale filenames
dw.web.Resource API (resource bundles provide locale-specific strings)
Templates are stored under locale folders; separate concept from resource bundles

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:

Why These Answers Are Correct
Setting up a Digital Server Connection in UX Studio requires authentication credentials and connection details to establish a secure link between the local development environment and the remote B2C Commerce instance. The three essential items are:

B. Instance Hostname – The URL of the target instance (e.g., dev01-realm.demandware.net). This tells UX Studio where to connect.
C. Business Manager Username – A valid BM account with appropriate permissions (typically Developer role or higher) to authorize the connection and perform operations like code deployment.
E. Business Manager Password – The corresponding password for authentication.

These credentials are entered in UX Studio's connection wizard, which establishes an authenticated WebDAV connection for file transfer and may use SOAP or REST APIs for additional operations. The connection allows developers to upload cartridges, import data, and synchronize changes between local and remote environments.

Why Other Options Are Incorrect
A. Instance Version – While useful information, the instance version isn't required to establish the connection. UX Studio can detect version information after connecting, or it may be automatically determined during the handshake.

D. Keystore Password – Keystore passwords are for certificate management and SSL configurations, not for basic Digital Server Connections. They might be needed for specific advanced configurations but aren't among the three essential items.

References
UX Studio Installation and Setup Guide: "Configuring Server Connections"
B2C Commerce Developer Onboarding: "Connecting Development Environments"

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 parameters to be "form-encoded" (this corresponds to the Content-Type application/x-www-form-urlencoded), the Developer should use the HTTP Form service type.

In the B2C Commerce Service Framework, choosing "HTTP" allows for standard RESTful interactions. However, the "Form" designation specifically tells the framework how to package the body of the request. Since weather services and many legacy REST APIs require parameters to be sent as key-value pairs in the body (similar to an HTML form submission), this service type provides the correct helper methods to serialize the data properly.

Why the Incorrect Answers are Wrong
A. FTP – File Transfer Protocol is used for moving large files (like catalogs or price books) between servers. It cannot be used to call a REST API for real-time data like weather.
B. SOAP – Simple Object Access Protocol is an XML-based protocol. If a service is "REST," it by definition is not SOAP. Using a SOAP service type would result in the wrong headers and envelope structure.
D. WebDAV – This is used primarily for managing the instance file system (uploading logs, static files, or code). It is not intended for external 3rd-party API integrations.

References
B2C Commerce Service Framework
Integrating External Web Services

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:

Creating and persisting a custom object in Salesforce B2C Commerce requires using the dw.object.CustomObjectMgr API. The method createCustomObject(type, key) is the standard way to instantiate a new custom object. Let’s break this down carefully:

Custom Object Type: This is the identifier of the custom object definition created in Business Manager. In this case, the type is "NewsletterSubscription".

Key Value: Every custom object requires a unique key. For the NewsletterSubscription object, the key attribute is email (of type String). When creating the object, you pass the actual value of the email field from the form, e.g., newsLetterForm.email.value.

Thus, the correct syntax is:
var customobject = dw.object.CustomObjectMgr.createCustomObject('NewsletterSubscription', newsLetterForm.email.value);

This ensures the object is created and persisted in the database with the email as its unique key.

Why Option C is Correct
- It uses the correct method: createCustomObject(type, key).
- It passes the type first ('NewsletterSubscription') and then the key value (newsLetterForm.email.value).
- This matches the documented API signature and ensures proper persistence.

Why the Other Options Are Incorrect
A. createNewsletterSubscription('email', newsLetterForm.email.value')
There is no such method as createNewsletterSubscription. The API only provides createCustomObject.

B. createCustomObject(newsletterForm.email.value, 'NewsletterSubscription')
The arguments are reversed. The first argument must be the type (NewsletterSubscription), not the key.

D. createCustomObject('NewsletterSubscription','email', newsLetterForm.email.value')
The method only accepts two arguments (type and key). Adding a third argument is invalid and will throw an error.

Reference
Salesforce B2C Commerce Developer Documentation – Custom Objects:
“Use dw.object.CustomObjectMgr.createCustomObject(type, key) to create and persist a custom object. The first parameter is the custom object type ID, and the second is the unique key value.”
Salesforce Developer Guide on Custom Objects

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:

Controllers in B2C Commerce's MVC architecture have specific responsibilities:

A. Generate the response as JSON or HTML – Controllers are responsible for final output generation. They determine the response format based on the request (e.g., AJAX calls return JSON, regular requests return HTML via ISML templates). This is done using res.json() for API endpoints or res.render() for views.

B. Use the Script API to generate data for the view – Controllers interact with B2C Commerce's Script API to fetch and process data from the platform (products, carts, customers, etc.), then prepare this data as a pipeline dictionary for the view. This is the "M" in MVC—preparing the model.

C. Use middleware functions when applicable – B2C Commerce controllers support middleware patterns through functions like server.get() with multiple handler functions. Middleware handles cross-cutting concerns like authentication, logging, or validation before reaching the main controller logic, promoting code reuse and separation of concerns.

Why Other Options Are Incorrect
D. Create a plain JavaScript object representing a system object – This describes data modeling, not a controller responsibility. System objects are represented by platform classes (like dw.catalog.Product), not plain JavaScript objects. Creating plain objects would lose all platform functionality.

E. Use the model needed for the view – While controllers prepare data for views, this phrasing is vague and overlaps with option B. More precisely, controllers prepare and provide the model; they don't "use" it in the same sense.

References
B2C Commerce MVC Architecture Documentation: "Controller Responsibilities"
Developer Guide: "Controller Patterns and Best Practices"
Script API Guide: "Data Access in Controllers"
Middleware Documentation: "Using Pipeline Functions in Controllers"

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:

Why A is correct
In Salesforce B2C Commerce (SFCC), resource bundles for template-localized text (like checkout labels) are stored in the templates/resources folder of the cartridge. The standard naming convention for locale-specific bundles is to append the language code (or full locale) directly after the base name with an underscore, resulting in files like checkout_de.properties for German (de).

This follows the Java ResourceBundle fallback mechanism used by SFCC: when the request locale is de (or de_DE), the system first looks for checkout_de.properties, then falls back to checkout.properties (default) if needed. Placing the file in the resources folder ensures it is automatically discovered and used by Resource.msg() calls in ISML templates. This is the official, recommended approach for adding German string values without duplicating templates or folders.

Why the other options are incorrect
B. checkout.properties in the de locale folder
→ Resource bundles do not go into locale-specific subfolders like templates/de. Locale-specific templates go there, but resources stay flat in templates/resources.
C. checkout.properties in the default locale folder
→ This would overwrite or duplicate the default English file. The default is checkout.properties (no suffix), and locale-specific files must have the suffix.
D. de_checkout.properties in resources folder
→ The suffix order is wrong. SFCC expects base_locale.properties (e.g., checkout_de), not the reverse locale_base.

References:
Salesforce B2C Commerce Developer Documentation → Localization → Localizing Template Resource Bundles
Trailhead: Localizing Storefront Components in B2C Commerce

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 and purchasable on a B2C Commerce storefront, several configuration layers must align.

B. The Storefront catalog that contains the product is assigned to a site
B2C Commerce uses a separation between the Master Catalog (owning the products) and the Storefront Catalog (defining the site structure). Even if a product exists, it won't appear on a specific website unless the Storefront Catalog containing that product is explicitly assigned to that Site in Business Manager.

D. The product is online and searchable
Every product has an "Online" toggle and "Searchable" toggle. If "Online" is false, the product is essentially disabled. If "Searchable" is false, the product will not appear in search results or category listings, even if it is technically online.

E. The search index is built
B2C Commerce does not query the database directly for storefront browsing. It queries a Search Index (Solr). After a product is marked as online and assigned to a catalog, the search index must be rebuilt (manually or via a job) so the index contains the updated product data.

Why the Others are Incorrect
A. The product has a Price – While a product usually needs a price to be purchased, it does not strictly need a price to be visible. A product with no price might show "N/A" or "Price Unavailable" depending on the template logic, but it will still show up in the catalog if the other conditions are met.

C. The product has a master product – This only applies to Variation Products. "Standard" products (standalone items) do not have a master product and can be perfectly visible on their own.

Reference
Salesforce B2C Commerce - Product Visibility Checklist
Rebuilding Search Indexes

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:

Why These Answers Are Correct
External system calls in pipelines require careful handling to prevent performance degradation and system instability:

B. Configure a timeout for the script pipelet
Setting appropriate timeouts prevents pipeline executions from hanging indefinitely when external systems are slow or unresponsive. Timeouts can be configured at the pipelet level in Business Manager or within the script logic itself using dw.system.Session.timeout settings. This ensures that if an external call exceeds the expected duration, the pipeline fails gracefully rather than consuming resources indefinitely, allowing other jobs to proceed.

D. Use asynchronous import or export jobs
For long-running external operations, asynchronous job execution prevents blocking the main pipeline thread. Asynchronous jobs run in the background, allowing the primary pipeline to complete quickly while the external system interaction continues separately. This is particularly important for import/export operations that might involve large data volumes or slow network connections. Asynchronous processing improves overall system responsiveness and prevents timeout issues in user-facing operations.

Together, these approaches create a robust error-handling and performance management strategy for external integrations.

Why Other Options Are Incorrect
A. Use synchronous import or export jobs – Synchronous execution blocks the pipeline until the external call completes, which directly causes performance issues when external systems are slow. This approach contradicts performance optimization goals and can lead to pipeline timeouts and degraded user experience.

C. Disable multi-threading – Multi-threading typically improves performance by allowing parallel processing. Disabling it would generally reduce performance, not prevent issues. While there might be specific thread-safety concerns with some external integrations, disabling multi-threading isn't a standard solution for external call performance problems.

References
Pipeline Development Guide: "Handling External System Calls"
Job Configuration Documentation: "Synchronous vs Asynchronous Job Execution"
Performance Tuning: "Timeout Configuration for External Integrations"

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:

Why the answers are right
The merchant wants to render personalized content on a category page via a Content Slot that targets VIP high-spending customers during a specific promotional period. This requirement has two distinct targeting dimensions:

- Audience targeting (VIP customers)
- Time-based targeting (promo period)

In B2C Commerce, the standard mechanism for audience targeting in merchandising tools is Customer Groups. A “VIP high-spending customers” segment is naturally represented as a Customer Group (either static or dynamic, depending on how VIP is defined). Once the VIP group exists, Business Manager can use it in targeting rules so the slot content is only shown to those customers.

For content slots, the object that stores rules for where, when, and to whom content appears is the Slot Configuration. Slot configurations can be scoped to contexts (global/category/etc.) and can define scheduling (start/end time) and targeting conditions (like customer groups). In other words, the slot configuration is the “control plane” that ties together: the slot placement, the content asset(s) to display, and the conditions (VIP + promo period) under which that display happens.

So, to meet the requirement, the developer (or merchandiser, depending on permissions) needs:
- A VIP Customer Group to represent the audience; and
- A Slot Configuration that targets that group and is scheduled for the promotional window.

This is also best practice because it keeps personalization in BM configuration rather than hard-coded logic in templates/controllers, allowing business users to adjust promo dates or VIP targeting without code deployments.

Why the other options are incorrect
B. Page Template — Not required. The slot already exists on the category page; you’re changing configuration, not creating a new page structure.

D. Rendering Template — Often you can use existing rendering templates (for content assets). A rendering template becomes necessary when you change the slot “content type” to something custom (like products/recommendations) or need special markup. For “personalized content asset during a period,” the slot configuration + customer group is the essential pair.

References
Manage and create content slot configurations (targeting/scheduling concepts)
Content slot and merchandising concepts overview (slot as configurable content placement)

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:

Salesforce B2C Commerce has a built-in feature for attributes called Localization. When defining a Product attribute in the System Object Type (Merchant Tools > Site Genesis > System Object Types > Product), you can check a box labeled "Localizable."

When an attribute is marked as localizable:
- The database creates a storage slot for every locale enabled on the site.
- In Business Manager, the merchant will see a dropdown to select a language (e.g., English, German, French) and enter a different "Model" value for each one.
- In the Storefront, when a user is browsing the German site, the platform automatically retrieves the value associated with the de locale. This is the cleanest and most scalable way to handle translated product data.

Why the Others are Incorrect
A is incorrect: Resource bundles are for static UI text (like "Add to Cart" or "Total"). They are not intended to store dynamic product data like a specific model name for 10,000 different items.

C is incorrect: Creating separate fields (e.g., model_en, model_de) is an "anti-pattern." It makes the code very difficult to maintain, as you would need complex if/else logic to determine which field to display, and it doesn't scale as you add more languages.

D is incorrect: Creating a new custom object for a single product field is massive overkill. It complicates data imports and slows down page load times due to extra database lookups.

Reference
Salesforce B2C Commerce - Localizable Attributes


Page 3 out of 17 Pages
Previous