SalesforceCCD-102Free

Salesforce CCD-102 B2C Commerce Developer with SFRA Free Practice Test - 20 Questions

This practice bank exercises your knowledge of Salesforce B2C Commerce SFRA development, covering core MVC architecture, controller lifecycle, form handling, ISML templating, service creation, model customization, job steps, localization, OCAPI caching, site preferences, search hooks, pipeline migration, logging, hooks vs jobs, caching strategies, CSRF protection, multi-site code sharing, and global error handling. By working through these 20 questions, you'll reinforce decisions about when to use decorators, how to extend models, where to define validation rules, and which SFRA components to apply for performance and security. The set emphasizes best practices and common patterns, preparing you for real-world implementation scenarios.

20
practice questions
20
recall cards
20
explanations
0
sign-ups required
Exam-focused analysis

What this CCD-102 practice set measures

This is an analysis of the practice bank, not a claim about the vendor's live exam blueprint. Use it to identify the knowledge, judgment, and recall patterns exercised here, then verify your coverage against the current official exam guide.

1. SFRA Architecture and Controller Patterns

Questions 1–3 and 6–7 focus on SFRA’s MVC layers and controller mechanics. You must understand that controllers handle requests and return responses, the init() method runs before actions, decorators like @after run after the main action, and model’s toJSON() is overridden for custom serialization. Form validation rules live in form model files, not controllers or templates. These questions test your grasp of separation of concerns and the framework’s lifecycle.

  • Controllers process HTTP requests; views render; models represent data.
  • init() runs before any action; @after hook runs after the action.
  • Form validation rules are defined in the form model JSON file.
  • Override toJSON() on a model to include custom attributes in output.

2. Services, Hooks, and Job Steps

Questions 4–5 and 9–10 and 13 cover service creation (extending LocalServiceRegistry), ISML template inclusion (isinclude directive), job step types (Script step runs custom JavaScript), localization (create new cartridge for new locale), and search customization (ProductSearch.beforeSearch hook). These items test your ability to integrate external systems, automate tasks, and extend built-in functionality through hooks and services.

  • Custom services extend LocalServiceRegistry via createService().
  • Use isinclude to include another template file in ISML.
  • Script steps in jobs execute custom JavaScript code.
  • For a new locale, create a cartridge with locale-specific properties.
  • ProductSearch.beforeSearch hook modifies search parameters before execution.

3. Data Access, Caching, and Security

Questions 11–12 and 17–18 address OCAPI caching (set in Business Manager), site preferences (Site.getCurrent().getCustomPreferenceValue()), caching strategies (serialized file caching for batch feeds), and CSRF protection (include CSRF token as hidden field). You need to know where configurations live, how to access custom attributes, and which security measures are standard in SFRA.

  • OCAPI cache expiration is configured in Business Manager settings.
  • Access site preferences via dw/system/Site API, not session or request.
  • Serialized file caching is suitable for static batch-generated feeds.
  • CSRF token must be added as a hidden field in POST forms.

4. Migration, Code Sharing, and Error Handling

Questions 14, 19, and 20 cover pipeline migration (convert steps to separate controller endpoints), multi-site code sharing (use a shared library cartridge), and global error handling (configure global error handler middleware). These questions test your ability to modernize legacy code, avoid duplication across sites, and implement consistent error responses.

  • Migrate pipelines by converting each step into a separate controller action.
  • Share models across sites using a shared library cartridge.
  • Global error handling is best done via server configuration middleware.
  • Avoid modifying system files; use cartridge-based customization.
Active recall deck

Practice Salesforce CCD-102 B2C Commerce Developer with SFRA with real flashcards

Read the prompt, commit to an answer, then flip the card. Move through the deck at your own pace and repeat any topic that does not come back quickly.

20 free cards

Card 1 of 20

1 reviewed this session

Static practice bank

Start the 20-question diagnostic

The complete question bank is embedded in this pre-rendered page. There is no database request or second content download when you begin.

Question 1 of 20

In SFRA, which layer is responsible for handling client requests and returning responses?

Show hint

Understand SFRA architecture and MVC pattern

1 correct answers

Study workflow

Turn one CCD-102 attempt into a study plan

  1. 1

    Identify the Request Handling Layer

    When a client request arrives, determine if it should be handled by a controller or a custom service. Controllers handle user-facing interactions and return views or JSON. Services handle external system communication or complex business logic. Always start by mapping the request to the correct SFRA layer.

  2. 2

    Implement Form Validation

    Create a form model JSON file under forms/default/ and define fields with validation rules (required, minLength, etc.). In the controller action, use form.get() to retrieve the model and form.isValid() to check. Avoid putting validation logic in templates; keep it in the model definition.

  3. 3

    Cache Static Resources Efficiently

    For batch-generated content like product feeds, use serialized file caching by writing the output to a cache file and serving it until the next generation. For dynamic data, consider server-side caching with a TTL. Monitor cache hit rates and adjust TTLs to balance freshness and performance.

  4. 4

    Add CSRF Protection to Forms

    In the controller that renders the form, generate a CSRF token using dw.web.CSRFProtection and pass it to the template. In the template, include it as a hidden input field named csrf_token. On form submission, verify the token in the controller before processing data.

  5. 5

    Set Up Global Error Handling

    In the server configuration file (server.js), add a global error handler middleware using app.use with a callback that catches errors and renders a custom error template. Log the error with Logger for debugging. This centralizes error responses and avoids repetitive try-catch blocks.

FAQ

Questions about this CCD-102 practice page

Clear boundaries on what the bank covers, how to use it, and where official vendor information still matters.

What is the role of the init() method in an SFRA controller?+

The init() method runs automatically before any action, regardless of HTTP method. It is used for common setup like session validation or setting up pre-requisites. It is not an action itself but a lifecycle hook that executes before action methods.

How do I create a custom service in SFRA that logs request and response?+

Use require('dw/system/Logger').getLogger() inside the service callback to log details. Call Logger methods for request/response data. There is no built-in logRequest method; you must add logging explicitly in the callback function.

What is the recommended way to share code across multiple sites in a multi-site environment?+

Create a shared library cartridge that contains common models, services, and scripts. Assign that cartridge to the site's cartridge path. This avoids code duplication and simplifies maintenance. Do not copy code into each site's cartridges.

Can I use a single controller action to handle multiple pipeline steps during migration?+

No. Best practice is to convert each pipeline step into a separate controller endpoint. This leverages SFRA's modular MVC pattern, making the code easier to maintain and test. A single action would defeat the purpose of migration.

How do I customize product search results to boost certain products?+

Use the ProductSearch.beforeSearch hook. In the hook implementation, modify the search parameters (like boosting criteria) before the search is executed. The afterSearch hook runs after results and is not suitable for boosting.

Keep studying

Build the next review session

Browse another free bank or use the study strategy guide to turn your misses into spaced review.