Salesforce-B2C-Commerce-Cloud-Developer Practice Test

Salesforce Spring 25 Release
202 Questions

A developer is tasked with the development of anew Page Designer Page Type, as requested by themerchant.
How should they define therendering logic of the page?

A. Implement a JavaScript file with a render () function.

B. Implement a metadata JSON file with a ''render'' property.

C. Implement a Controller file with a ''render'' route.

A.   Implement a JavaScript file with a render () function.

Explanation:
When creating a new Page Designer Page Type in Salesforce B2C Commerce, one of the key tasks is to define how the page should render on the storefront. This is done by providing rendering logic in the form of a JavaScript module that includes a render() function.

πŸ”§ How It Works:
The rendering logic is specified in a JavaScript file, usually placed in:
/cartridge/scripts/render/pageTypeName.js
The file must export a render() function, which is automatically called by Page Designer when the page is rendered.

🧩 Example:
'use strict';
function render(contextObject) {
var template = 'pages/pageTypeTemplate';
return {
template: template,
context: contextObject
};
}

module.exports.render = render;
This render() function tells Page Designer which ISML template to use and provides the context data for rendering.

πŸ“ Page Type Metadata Example (for reference):
In the Page Type JSON metadata, you reference the rendering module:

{
"page_type_id": "custom-page-type",
"name": "Custom Page Type",
"description": "My custom page type",
"template": "default",
"render_template": "app_custom/cartridge/scripts/render/customPageType.js"
}

❌ Why the Other Options Are Incorrect:
B. Metadata JSON with a render property
❌ The metadata JSON defines structure, not render logic. It points to the rendering JS file but doesn’t contain the logic itself.
C. Controller with a render route
❌ Page Designer does not rely on custom controllers for rendering. It uses the render module internally within its framework.

πŸ“˜ Reference:
Page Designer Developer Guide
Rendering Logic – Page Designer

Salesforce-B2C-Commerce-Cloud-Developer Practice-Test - Home Previous
Page 35 out of 202 Pages