A developer is working on a storefront and is seeing unexpected Ul behavior in one of the custom Lightning web components (LWCs) their team has built. How should the developer investigate the issue?
Correct Answer: A
To investigate the issue of seeing unexpected UI behavior in one of the custom Lightning web components (LWCs) their team has built, the developer should enable Debug Mode for a storefront user, log in to the storefront, and use Browser Inspection tools and debugger points. Debug Mode is a feature that allows developers to debug and troubleshoot custom LWCs in the storefront by disabling performance optimizations and enabling source maps. Source maps are files that map the minified or obfuscated code to the original source code, making it easier to read and debug. To enable Debug Mode for a storefront user, the developer can go to Setup, enter Users in the Quick Find box, select Users, click Edit next to the user name, and select Debug Mode. After enabling Debug Mode, the developer can log in to the storefront as the user and use Browser Inspection tools and debugger points to inspect and debug the custom LWC. Browser Inspection tools are tools that are built into web browsers that allow developers to examine and modify the HTML, CSS, JavaScript, and other aspects of a web page. Debugger points are statements that are added to the JavaScript code of a LWC that pause the execution of the code at a certain point and allow the developer to inspect the values of variables, expressions, and other elements. Enable Debug Mode for a storefront user, load the LWC in Visual Studio (VS) Code, attach to session, and view debug logs in VS Code is not a valid way to investigate the issue of seeing unexpected UI behavior in one of the custom LWCs their team has built, as it is not possible to attach to a session or view debug logs for LWCs in VS Code. Enable debug logs for a storefront user, log in to storefront and perform action, and view debug logs in Setup is not a valid way either, as debug logs do not capture information about LWCs or UI behavior. Debug logs are records of database operations, system processes, and errors that occur when executing a transaction or running unit tests. Identify the user, inputs, and failure, then ask Salesforce support to investigate the issue with the custom LWC is not a valid way either, as it is not a recommended or efficient way of debugging or troubleshooting custom LWCs. Salesforce support may not be able to provide assistance or guidance for custom LWCs that are developed by third-party developers. Salesforce References: B2B Commerce Developer Guide: Debug Lightning Web Components, Lightning Web Components Developer Guide: Debug Your Code, Salesforce Help: Debug Logs
B2B-Commerce-Developer Exam Question 147
While working on a commerce rollout, a developer needs to update the checkout process so that buyers can purchase with one of the below payment types. * Credit Card * Purchase Order * Contract Now & Pay Later Additionally, the developer needs to show only Purchase Order and Contract Now & Pay Later if a custom checkbox field on the account is checked. How should the developer meet these requirements?
Correct Answer: B
To update the checkout process so that buyers can purchase with one of the below payment types: * Credit Card * Purchase Order * Contract Now & Pay Later Additionally, show only Purchase Order and Contract Now & Pay Later if a custom checkbox field on the account is checked, a developer should create a custom Lightning web component for the checkout flow that has all the options available. Within that component, pulldata from the account to determine which options to show. Creating a custom Lightning web component for the checkout flow allows the developer to define custom logic and user interface for processing payments using different payment types. The developer can use Apex methods or third-party APIs to integrate with payment service providers or payment gateways and handle payment authorization, capture, void, and refund. The developer can also use @wire or @api decorators to get data from the account object and use its properties, such as the custom checkbox field, to determine which payment options to show or hide based on business logic. Creating a custom Lightning web component that can be used with the standard payment component is not a valid way to meet this requirement, as it does not allow the developer to replace or modify the standard payment component's logic or user interface. Modifying the standard payment component settings in the checkout screen flow and adding the new payment method is not a valid way either, as it does not allow the developer to add custom payment types or conditional logic based on account data. Adding a new payment gateway through the reference implementation steps so the payment shows up on the checkout payment screen is not a valid way either, as it does not allow the developer to add multiple payment options or conditional logic based on account data. Salesforce References: B2B Commerce Developer Guide: Payment Integration, B2B Commerce Developer Guide: Payment Component, B2B Commerce Developer Guide: Checkout Subflow
B2B-Commerce-Developer Exam Question 148
What is the purpose of connectedCallback in a Lightning web component?
Correct Answer: D
Explanation The connectedCallback is a lifecycle hook that is invoked when a Lightning web component is inserted into the DOM. It is used to perform any initialization tasks that depend on the component being rendered, such as fetching data, setting up event listeners, or creating timers. The connectedCallback can fire more than once, for example, when a component is moved or rerendered. The connectedCallback should not be used to change the state of a component, such as loading values or setting properties. Use getters and setters instead. The other options are incorrect because they do not describe the purpose of the connectedCallback. References: Lifecycle Hooks | Lightning Web Components Developer Guide, connectedCallback() in Lightning Web Component - Salesforce Diaries, Chapter 23: connnectedCallback() in Lightning Web Component
B2B-Commerce-Developer Exam Question 149
What is the purpose of connectedCallback in a Lightning web component?
Correct Answer: D
The connectedCallback is a lifecycle hook that is invoked when a Lightning web component is inserted into the DOM. It is used to perform any initialization tasks that depend on the component being rendered, such as fetching data, setting up event listeners, or creating timers. The connectedCallback can fire more than once, for example, when a component is moved or rerendered. The connectedCallback should not be used to change the state of a component, such as loading values or setting properties. Use getters and setters instead. The other options are incorrect because they do not describe the purpose of the connectedCallback. References: Lifecycle Hooks | Lightning Web Components Developer Guide, connectedCallback() in Lightning Web Component - Salesforce Diaries, Chapter 23: connnectedCallback() in Lightning Web Component
B2B-Commerce-Developer Exam Question 150
Which format is the custom Salesforce relationship with the API name, "My_Relationship_Name__r.My_Name__c" queried and transformed into dy default in Salesforce B2B Commerce?
Correct Answer: C
The format that the custom Salesforce relationship with the API name, My_Relationship_Name__r.My_Name__c is queried and transformed into by default in Salesforce B2B Commerce is myRelationshipName.myName: value. This is done to follow the JavaScript naming convention and to avoid conflicts with the standard Salesforce fields and relationships. The transformation rules are as follows: Remove any namespace prefix from the field name, such as ccrz__ or cloudcraze__. Remove any underscores from the field name and capitalize the first letter of each word after an underscore, such as MyRelationshipName and MyName. Lowercase the first letter of the field name, such as myRelationshipName and myName. Use a dot (.) to separate the relationship name and the field name, such as myRelationshipName.myName. Use a colon (:) to separate the field name and the field value, such as myRelationshipName.myName: value. Salesforce Reference: B2B Commerce and D2C Commerce Developer Guide, Query Transformation