Home / Salesforce Certified B2C Commerce Developer / Mock exam
Salesforce Certified B2C Commerce Developer Exam-style mock test

Salesforce B2C Commerce Developer Practice Exams|Practice test

Full explanations Exam format Pass line 65%
33 USD One-time · lifetime access
Enroll →

Sample questions

Example1 · SFRA Architecture, Controllers, and Models
A developer at a B2B SaaS company is building the subscription landing page for SFRA. They need to understand what a controller is primarily responsible for when a storefront URL is requested. Which statement best describes the role of an SFRA controller?
・It compiles ISML templates into cached static HTML files that are served directly to the browser without any server-side logic running per request.
Incorrect. ISML templates are rendered per request by controllers; they are not precompiled into static cached HTML served without server logic.
✓It handles the incoming request, orchestrates business logic, and renders a response via templates or JSON.
Correct. A controller receives the request, coordinates business logic and models, then renders an ISML template or returns JSON.
・It stores persistent customer and order records in the database and enforces referential integrity across custom objects.
Incorrect. Persistent storage is handled by the data layer and system/custom objects, not by the controller itself.
・It defines the visual CSS styling and client-side JavaScript behavior that runs exclusively inside the shopper's browser.
Incorrect. CSS and client-side JavaScript are presentation concerns; controllers run server-side and do not define browser styling.
Explanation
In SFRA's MVC pattern, controllers are the entry point that handle requests, invoke models and business logic, and produce the rendered response.
Example2 · ISML Templates, Content, and URLs
A developer at a B2B SaaS company is building the subscription plan detail template. They need to loop over the pdict.Plan.features collection and render each feature name inside a list. Which ISML construct correctly iterates the collection?
・<isscript>pdict.Plan.features.forEach(function(f){ out.print(f.name); });</isscript>
Incorrect. <isscript> runs server-side script but out.print is not a supported way to emit markup here, and this bypasses the standard iteration tag.
✓<isloop items="${pdict.Plan.features}" var="feature">${feature.name}</isloop>
Correct. <isloop> with the items and var attributes is the standard ISML tag for iterating a collection and rendering each element.
・<isrepeat value="${pdict.Plan.features}" alias="feature">${feature.name}</isrepeat>
Incorrect. <isrepeat> with value and alias attributes is not a valid ISML tag; the iteration tag is <isloop>.
・<isforeach collection="${pdict.Plan.features}" element="feature" status="loopState">${feature.name}</isforeach>
Incorrect. <isforeach> with collection, element, and status attributes is not a valid ISML tag name in SFCC.
Explanation
ISML provides <isloop> with items and var (or begin/end/step) attributes to iterate collections and render dynamic content; the other tag names do not exist.
Example3 · Business Manager, Jobs, and Site Configuration
A developer at a B2B SaaS company needs to expose a new site-level toggle, 'enableBulkQuoteFlow', so that business users can switch it on per locale without a code deployment. Where should the developer define this preference so it appears under Merchant Tools > Site Preferences > Custom Preferences?
✓In a meta definition file imported into the system object type SitePreferences, then assigned to a custom preference group
Correct. Custom site preferences are declared by extending the SitePreferences system object with a metadata (meta) definition and grouping the attributes into a custom preference group, which renders them in Business Manager for business users to edit per site and per locale.
・As a hardcoded constant inside the cartridge controller that reads the value at request time
Incorrect. A hardcoded constant cannot be edited by business users in Business Manager and is not locale-aware, so it defeats the purpose of a configurable site preference.
・In the resource bundle properties file for the storefront locale being configured
Incorrect. Resource bundles hold localized display strings for the storefront, not editable configuration values surfaced under Site Preferences.
・In the services.xml file that the platform scans at startup to build the preferences UI automatically
Incorrect. services.xml configures web service profiles and credentials, not site preference metadata, and the preferences UI is driven by system object metadata rather than that file.
Explanation
Custom site preferences are created via a meta definition that extends SitePreferences and are organized through custom preference groups so business users can edit them in Business Manager.
Example4 · OCAPI, SCAPI, Hooks, and Integrations
A healthcare services firm is building a new patient-facing appointment-booking mobile app that must consume Salesforce B2C Commerce storefront data. The lead architect wants the most future-proof, OAuth2-based headless API that Salesforce actively invests in for new headless projects. Which API should the team adopt?
✓Salesforce Commerce API (SCAPI), the modern RESTful headless API set
Correct. SCAPI is the modern RESTful, OAuth2-secured API family that Salesforce recommends and actively develops for new headless and composable storefront projects.
・Open Commerce API (OCAPI) Shop API using the legacy client-id query parameter
Incorrect. OCAPI Shop API still works but is the legacy option; Salesforce steers new headless builds toward SCAPI rather than the older client-id pattern.
・The Script API classes exposed directly over an unauthenticated public HTTPS endpoint
Incorrect. Script API classes run server-side within cartridge code and are not exposed as a public unauthenticated HTTPS endpoint.
・The Data API of OCAPI, intended primarily for back-office administrative data management rather than storefront shopping flows
Incorrect. The OCAPI Data API targets back-office administrative data management, not patient-facing storefront shopping interactions.
Explanation
SCAPI is the current, strategically-invested headless API set for new B2C Commerce projects, while OCAPI remains supported but legacy.
Example5 · Data Model, Search, and Performance
A developer at a healthcare services firm must store patient appointment reminders that are not tied to any native Salesforce B2C Commerce object and need their own attributes. Which approach correctly extends the data model to persist this data?
・Add new system attributes directly onto the Site Preferences object group so the reminder fields are editable in Business Manager
Incorrect. Site Preferences hold configuration values, not arbitrary per-record business data like individual appointment reminders.
✓Define a custom object type in the metadata, then create and query instances with CustomObjectMgr
Correct. A custom object type defines a schema in metadata, and CustomObjectMgr creates, retrieves, and queries its instances at runtime.
・Store each reminder as a serialized JSON string inside a single custom preference value
Incorrect. Serializing many reminders into one preference value prevents indexed querying and risks exceeding value size limits.
・Create a new product attribute group and attach the reminder fields to every product in the catalog
Incorrect. Reminders are unrelated to products, so forcing them onto product attribute groups pollutes the catalog model.
Explanation
Custom objects are the standard mechanism for persisting bespoke business data with its own attributes, managed through CustomObjectMgr.
Example6 · SFRA Architecture, Controllers, and Models
A developer at a healthcare services firm is building a SFRA storefront for booking telehealth appointments. When a patient navigates to the appointment landing page, which SFRA component is responsible for receiving the HTTP request, orchestrating the response, and rendering the ISML template?
・A model, which gathers pricing and inventory data and passes a fully assembled view object directly to the browser without template involvement
Incorrect. Models prepare data for the view, but they do not receive HTTP requests or bypass the template rendering layer.
✓The controller, which maps the route, runs middleware, assembles the view data, and renders the template
Correct. In SFRA the controller handles the route, executes middleware, builds the pdict view data, and triggers template rendering for the response.
・A script module in the int_appointment cartridge that only exposes reusable helper functions to other scripts
Incorrect. Script modules provide reusable logic but are not the entry point that handles routed HTTP requests.
・The ISML template, which queries the database and then calls the storefront session manager to build the page
Incorrect. ISML templates render presentation markup; they do not receive routed requests or query data stores directly.
Explanation
Controllers are the request entry point in SFRA, coordinating middleware, models, and template rendering.
Example7 · SFRA Architecture, Controllers, and Models
A developer at the LumaTrail outdoor-gear storefront adds a controller route with server.get('Show', server.middleware.https, consentTracking.consent, function (req, res, next) {...}). During a request to this route, how does SFRA process the registered middleware functions before the final handler runs?
・SFRA executes every middleware for the route in parallel threads and merges their res output once the slowest one finishes before invoking the final handler function.
Incorrect. SFRA middleware is not executed in parallel threads; the chain is sequential and depends on each function calling next().
✓SFRA runs each middleware in the order it was added, and each must call next() to pass control to the following function in the chain.
Correct. The middleware chain runs in registration order, and control advances only when a function calls next(), reaching the route handler last.
・SFRA ignores the order and runs middleware alphabetically by function name, invoking the final handler only after the last alphabetical entry returns.
Incorrect. Execution order follows registration order, not alphabetical function naming.
・SFRA runs only the final handler and treats the earlier functions as documentation hints that are stripped out at compile time.
Incorrect. Earlier middleware functions are executed, not stripped; they perform real work such as enforcing HTTPS or consent tracking.
Explanation
In SFRA the server object builds an ordered middleware chain. Each function receives (req, res, next) and must call next() to pass control down the chain, with the route handler executing last.
Example8 · SFRA Architecture, Controllers, and Models
On the LumaTrail storefront, a developer must add a loyalty banner to the data that the base Product-Show controller already assembles, without rewriting the base route's logic. Which approach correctly extends the existing controller in the custom cartridge?
・Call server.replace('Show', ...) so the custom handler takes over completely and then manually re-implement every step the base controller performed before adding the banner.
Incorrect. server.replace discards the base logic and forces a full re-implementation, which is exactly what the requirement says to avoid.
✓Call server.append('Show', function (req, res, next) {...}) to run extra logic after the base handler and augment the existing view data.
Correct. server.append adds a middleware step that runs after the base handler, letting the developer read res.viewData and add the loyalty banner.
・Import the base controller module and mutate its exported route array directly at module load time before any request arrives.
Incorrect. Directly mutating another cartridge's exported route array is not the supported extension mechanism and is fragile.
・Register a brand-new route named ShowBanner and rely on the storefront to call it automatically after Product-Show finishes.
Incorrect. SFRA does not automatically chain a separate route after another controller completes.
Explanation
server.append registers additional middleware that executes after the inherited handler, which is the correct way to augment view data without re-authoring the base route. Note the explanations array must have exactly four entries matching the four options.
Example9 · SFRA Architecture, Controllers, and Models
A LumaTrail controller needs to expose a computed shipping estimate to an ISML template. The developer sets res.setViewData({ shippingEstimate: estimate }) and then calls res.render('product/shippingPanel'). How does the ISML template access the value?
✓Through the implicit pdict object, for example ${pdict.shippingEstimate}, because SFRA merges the view data into pdict for the rendered template.
Correct. SFRA exposes the accumulated view data to the template as pdict, so ${pdict.shippingEstimate} renders the value.
・Through a global session.custom variable that the render call copies the view data into before the template executes.
Incorrect. View data is not written to session.custom; it is attached to the rendering context as pdict.
・Through request.httpParameterMap.shippingEstimate, since render serializes view data onto the query string of the current request.
Incorrect. render does not place view data onto httpParameterMap or the query string.
・It cannot, because view data is only readable by other middleware and never reaches the template layer.
Incorrect. View data is specifically the mechanism for passing values from controllers to templates via pdict.
Explanation
res.setViewData accumulates values that SFRA passes to the ISML template as the pdict object when res.render executes, so templates read ${pdict.property}.
Example10 · SFRA Architecture, Controllers, and Models
A developer at a financial services firm is building a storefront where shoppers browse investment-product bundles. When a URL maps to a controller endpoint, which component is responsible for defining that endpoint and orchestrating the response in SFRA?
・A model script that quejson the database and serializes the raw System objects directly to the HTTP response stream for the client
Incorrect. Models shape data for the view but do not define routable endpoints, and serializing raw System objects to the response is not how SFRA controllers operate.
✓A controller function exported with a route name that handles the request and renders a template
Correct. In SFRA a controller exports a named function (the route) that receives the request, invokes models, and renders a template as the response.
・A pipeline XML file configured in the Business Manager site preferences for that storefront
Incorrect. Pipelines are the legacy routing mechanism that SFRA replaced with JavaScript controllers; they are not configured in site preferences.
・An ISML decorator template
Incorrect. A decorator template only wraps page markup and cannot define a routable server endpoint.
Explanation
SFRA controllers are JavaScript modules whose exported functions map to routes, orchestrating models and rendering templates.
Example11 · SFRA Architecture, Controllers, and Models
A developer must add a credit-check flag to the view data of the existing Account-Show route without rewriting the base SFRA logic that already loads the customer's profile. Which approach correctly extends the route in the custom cartridge?
・server.replace('Show', ...) so the base controller logic is discarded and the credit-check flag is set in a brand-new handler written from scratch
Incorrect. server.replace discards the base logic entirely, which contradicts the requirement to keep the existing profile-loading behavior intact.
✓server.append('Show', ...) to add a middleware step that sets the credit-check flag after the base logic runs
Correct. server.append adds a middleware step that runs after the base handler, letting the developer augment the view data without rewriting base logic.
・Editing the base app_storefront_base cartridge Account.js file directly
Incorrect. Editing app_storefront_base directly is prohibited because the base cartridge must remain unmodified for upgradability.
・Overriding res.render only
Incorrect. Overriding only res.render would not cleanly append a middleware step and risks breaking the chain.
Explanation
server.append chains a new middleware function after the existing route, the correct way to augment base behavior.
Example12 · SFRA Architecture, Controllers, and Models
A developer at an industrial parts distributor adds a new route to the Cart controller so that a storefront URL maps to server.get('Show', ...). When the shopper requests that URL, which component is responsible for matching the incoming URL to the correct controller and exported route?
・The ISML template referenced in the final res.render() call, which resolves the URL against the cartridge template path
Incorrect. Templates are rendered at the end of the chain by res.render(); they do not match incoming URLs to controllers.
✓The platform routing layer, which maps the URL path to the controller and its exported route name
Correct. SFRA relies on the platform routing layer to parse the request URL and dispatch it to the matching controller and exported route.
・The models folder, whose exported constructors are indexed by URL and returned to the client
Incorrect. Models hold data abstractions; they are never indexed by URL for dispatch purposes.
・The dw.system.Pipeline object configured in the business manager routing table for that site
Incorrect. SFRA controllers are JavaScript, not pipelines; there is no business-manager pipeline routing table involved.
Explanation
In SFRA the platform routing layer parses the requested URL and dispatches to the controller endpoint (e.g., Cart-Show) that was registered via server.get/server.post.
Example13 · SFRA Architecture, Controllers, and Models
The distributor needs a new endpoint on the Account controller that must only run for authenticated B2B buyers. The developer wants to reuse an existing login guard. Which approach correctly registers the route so the guard runs before the route's own logic?
・Place the login guard inside res.render() so the template enforces the authenticated state before any markup is produced
Incorrect. res.render() only produces output; it cannot sequence authentication middleware before route logic.
✓Pass the login guard as a middleware argument before the final handler in the server.get route chain
Correct. In SFRA, middleware functions are supplied as arguments in the route chain and execute in order before the final handler.
・Call the login guard from within the final handler and then invoke next() to continue
Incorrect. Calling the guard inside the final handler runs it too late and inverts the intended ordering.
・Add the login guard to the module.exports object so it is applied to every exported route automatically
Incorrect. Adding a function to module.exports does not create a global middleware; routes must list their middleware explicitly.
Explanation
SFRA routes are built from an ordered middleware chain: server.get('Name', guardMiddleware, finalHandler). Middleware listed before the handler runs first.
Example14 · SFRA Architecture, Controllers, and Models
A telecom operator's storefront built on SFRA receives a request for the plan catalog landing page. A developer wants to understand what a controller's primary responsibility is within the SFRA request lifecycle. Which statement best describes the role of the controller?
・It compiles ISML templates into cached Java bytecode and serves the rendered markup directly to the browser without any server middleware
Incorrect. ISML templates are rendered at request time through the rendering framework, not precompiled to cached bytecode served without middleware; this misstates the pipeline.
✓It handles the incoming request, orchestrates models and renders a response
Correct. A controller is the entry point for a route: it processes the request, invokes models and scripts to assemble data, and renders the template or returns a response.
・It stores persistent plan and subscription records in the custom object database for later retrieval by batch jobs
Incorrect. Persisting records to custom objects is a data-storage concern handled by scripts and the ORM, not the defining role of a controller.
・It defines the system and custom attributes of business objects such as Product and Category in the metadata layer
Incorrect. Defining object attributes is done in Business Manager metadata and system objects, not within a controller's runtime responsibility.
Explanation
In SFRA, the controller is the MVC entry point that receives the request, coordinates models/scripts, and renders a response.
Example15 · SFRA Architecture, Controllers, and Models
On the telecom operator's site, a developer needs the 'Account-EditProfile' route to run only for logged-in customers. Which SFRA middleware should be added to the route chain to enforce this requirement?
・server.middleware.https
Incorrect. server.middleware.https enforces a secure HTTPS connection for the route but does not check authentication state.
✓userLoggedIn.validateLoggedIn
Correct. The userLoggedIn.validateLoggedIn middleware verifies that a customer is authenticated and redirects to login otherwise, which is the correct guard for protected account routes.
・csrfProtection.validateRequest
Incorrect. csrfProtection.validateRequest validates CSRF tokens on form submissions and does not confirm that the customer is logged in.
・consentTracking.consent
Incorrect. consentTracking.consent manages the tracking-consent dialog and gating, not authentication enforcement.
Explanation
userLoggedIn.validateLoggedIn is the SFRA middleware that restricts a route to authenticated customers.
▶ Try 10 free questions (graded)
Measure your readiness with a full mock exam
All questions · full explanations · lifetime access
Enroll(33 USD)