A developer is building a custom component in Lightning web components (LWC) that has a grandchild component that needs to pass information to the grandparent component. What is the correct way to demonstrate the passing of a message from the grandchild component to the grandparent component?
Correct Answer: B
The correct way to demonstrate the passing of a message from the grandchild component to the grandparent component in LWC is to use the PubSub library. The PubSub library is a utility that enables Lightning web components to communicate across the DOM tree without using intermediaries. The grandchild component can publish a message to a channel, and the grandparent component can subscribe to that channel and receive the message. This way, the communication is decoupled and does not depend on the component hierarchy. Option B shows the correct syntax for using the PubSub library to pass a message from the grandchild component to the grandparent component. Option A is incorrect because it uses th@apidecorator to expose a property on the grandchild component, which is not a valid way to communicate with the grandparent component. Option C is incorrect because it uses the@wiredecorator to wire a property on the grandchild component to a function on the grandparent component, which is also not a valid way to communicate with the grandparent component. Option D is incorrect because it uses the@trackdecorator to track a property on the grandchild component, which is not a valid way to communicate with the grandparent component.Communicate Across the DOM | Lightning Web Components Developer Guide,Child to grandparent communication in LWC,PubSub Library for Lightning Web Components
Question 42
Numerous flags ... have a directimpact on the result set provided by the Global API's. What Global API Data-Sizing convention flag prevents an API request from propagating to further requests when provided as a Boolean parameter with a value of true?
Correct Answer: B
The Global API Data-Sizing convention flag that prevents an API request from propagating to further requests when provided as a Boolean parameter with a value of true is ccrz.ccAPI.SZ_ASSC. This flag indicates that only one API request should be executed with the specified sizing block, and any subsequent requests should use their own default sizing blocks. For example,ccrz.ccServiceCart.getCart(ccrz.ccAPI.SZ_L,true)will use the SZ_L sizing block for retrieving the cart data, but any other requests that are triggered by this method will use their own default sizing blocks. Salesforce B2B Commerce and D2C Commerce Developer Guide,Data Sizing Conventions
Question 43
Inwhich three different ways can a theme be enabled in Salesforce B2B Commerce? (3 answers)
Correct Answer: A,B,E
A theme can be enabled in Salesforce B2B Commerce in three different ways: A Storefront setting: The theme can be specified in the Storefront Configuration settings in CCAdmin. This will apply the theme to all users who access the storefront. An Account Group field value: The theme can be specified in the Theme field of an Account Group record in Salesforce. This will apply the theme to all users who belong to that account group. Dynamically through a hook: The theme can be specified dynamically by extending the cc_hk_theme hook. This hook allows changing the theme based on various factors, such as the user, cart, product, or storefront. For example, the hook can apply a different theme for a specific product category or for a specific user segment.
Question 44
What does a developer need to do to modify the out-of-the-box checkout flow template?
Correct Answer: A
To modify the out-of-the-box checkout flow template in Salesforce B2B Commerce, a developer should clone the existing template, make the necessary modifications, activate the modified template, and then reference it in the Experience Builder. This approach ensures that the original template remains intact and provides a fallback option. Salesforce documentation on customizing the checkout flow in B2B Commerce emphasizes the importance of using the Experience Builder for such customizations, providing a visual interface to manage and reference different checkout flow templates.
Question 45
A developer is on a tight timeline and needs to implement a Lightning web component which can read, create and modify single records. What is the recommended path forward?
Correct Answer: D
To implement a Lightning web component which can read, create and modify single records, the recommended path forward is to use Lightning Data Service. Lightning Data Service is a service that provides access to Salesforce data and metadata, cache management, and data synchronization across components. Lightning Data Service allows developers to use standard components or base components to perform CRUD (create, read, update, delete) operations on single records without writing Apex code or SOQL queries. Lightning Data Service also handles data caching, performance optimization, and conflict resolution automatically. Using base components is not a sufficient way to implement a Lightning web component which can read, create and modify single records, as base components are only user interface elements that do not provide data access or manipulation functionality by themselves. Base components need to be used with Lightning Data Service or other services to perform CRUD operations on single records. Writing custom functions against a wire adapter is not a recommended way to implement a Lightning web component which can read, create and modify single records, as it involves writing complex and error-prone JavaScript code that may not be efficient or scalable. Writing custom functions against a wire adapter also requires handling data caching, performance optimization, and conflict resolution manually. Creating an Apex controller is not a recommended way either, as it involves writing Apex code that may not be necessary or optimal for performing CRUD operations on single records. Creating an Apex controller also requires exposing Apex methods using @AuraEnabled or @RemoteAction annotations and invoking them from JavaScript code using imperative calls or promises. Salesforce Lightning Web Components Developer Guide: Access Salesforce Data,Lightning Web Components Developer Guide: Base Components, [Lightning Web Components Developer Guide: Call Apex Methods]