CCD-102 practice question 14 of 30
A client wants to differentiate their monobrand stores with a special icon when shown in the store locator. The information is saved in a true/false custom attribute for each Store object in Merchant tools. How should the developer follow SFRA best practices to expose this data for rendering?
Full set: 206 questionsThe Storefront Reference Architecture (SFRA) promotes a model-view-controller (MVC) pattern where models are responsible for preparing data as plain JavaScript objects for the view (template). The standard and best practice for adding a custom attribute to the data passed to the template is to extend the relevant base model. By using module.superModule, a developer can inherit the functionality of the base store model, execute its original logic via the call method, and then append the new custom attribute (isMonobrand) to the resulting view model object. This approach maintains separation of concerns and aligns with SFRA's core extensibility principles.
1. Salesforce B2C Commerce Developer Documentation
"Extend a Model": This official guide explicitly details the correct pattern for extending a model in SFRA. It states
"To extend a model
you create a file with the same name in your custom cartridge... Get a reference to the base model using the module.superModule property... In the constructor
call the base model constructor... Add or modify properties on the this object." This directly supports option D.
Source: Salesforce B2C Commerce Developer Documentation
"SFRA -> Develop with SFRA -> Customize a Model -> Extend a Model".
2. Salesforce B2C Commerce Developer Documentation
"Storefront Reference Architecture": The documentation on SFRA's architecture emphasizes the use of simple JSON objects (view models) to pass data from controllers to rendering. It states
"The script controller file calls the model to get a simple JSON object...". This principle invalidates option B
which suggests passing complex system objects.
Source: Salesforce B2C Commerce Developer Documentation
"SFRA -> SFRA Concepts -> Models and View Models".
3. Salesforce B2C Commerce Developer Documentation
"Migrate from SiteGenesis to SFRA": This document highlights key differences
noting the move away from tags for business logic. It reinforces that logic should be handled in controllers and models
making option C an outdated and incorrect approach for SFRA.
Source: Salesforce B2C Commerce Developer Documentation
"SFRA -> Migrate from SiteGenesis to SFRA -> Controllers and Routes".
Keep practicing
Take the free CCD-102 practice test
Ten exam-style questions with answers and explanations, plus the exam facts and study guides.
More questions
Other CCD-102 practice questions
- Question 1A developer has a sandbox with code to log a message during execution, and the following …
- Question 3Server.get(‘Show’, consentTracking.consent, cache.applyDefaultCache, function (req,res,ne…
- Question 4A developer needs to update the package.json file so that it points to the hock file for …
- Question 5A developer wants to create in Business Manager extension with the cartridge named plugin…
- Question 6A client uses tax tables in Business Manager to calculate tax. They recently started ship…
- Question 7A Digital Developer has a site export file on their computer that needs to be imported in…
