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
Question 112
What are two ways a developer should ensure that a store verifies changes by using an external service?
Correct Answer: B,C
To verify changes by using an external service, a developer can use either of these two ways: * Create an Apex class that implements the sfdc_checkout.CartShippingCharges interface and defines the getShippingCharges method. This method takes a Cart object as an input parameter and returns a list of CartDeliveryGroupMethod objects with the updated shipping charges. The developer then needs to register the Apex class as the Shipping Calculation Integration in the store administration. This way, the store can call the external service to calculate the shipping charges for each delivery group in the cart. * Create an Apexclass that defines a method to retrieve the shipping charges from an external service and update the Cart Delivery Group Method object. The developer then needs to invoke this method from a trigger on the Cart Delivery Group Method object. This way, the store can update the shipping charges whenever the delivery group method is inserted or updated. The other options are not valid ways to verify changes by using an external service. Creating a flow using an action is not supported for B2B Commerce, and creating a trigger on the Cart Delivery Group object will not update the shipping charges for each delivery group method. References: * Integrate with External Services * CartShippingCharges Interface * CartDeliveryGroupMethod Object
Question 113
What is a best practice when passing query parameters from user interface to an apex controller?
Correct Answer: A
Explanation A best practice when passing query parameters from user interface to an apex controller is to query parameters should be properly sanitized by using JSINHTMLENCODE within the VisualForce Page or Component. This function will encode any special characters in the query parameters to prevent cross-site scripting (XSS) attacks or SOQL injection attacks. For example, ccrz.ccRemoteActions.getProducts('{!JSINHTMLENCODE(searchTerm)}') will encode the searchTerm parameter before passing it to the apex controller. Salesforce References: B2B Commerce and D2C Commerce Developer Guide, Security
Question 114
Which handlebars helper function is used on Salesforce B2B Commerce pages and components for formatting price values?
Correct Answer: A
The handlebars helper function that is used on Salesforce B2B Commerce pages and components for formatting price values is formatPrice. This function will format a numeric value as a price according to the currency settings and locale of the storefront. For example, {{formatPrice price}} will format the price value as $1,234.56 for US dollars or €1.234,56 for euros. Salesforce References: B2B Commerce and D2C Commerce Developer Guide, Handlebars Helpers
Question 115
A new payment type for the Checkout flow has been implemented. Which three descriptors follow best practice for possible configuration metadata are needed to enable a flow? (3 answers)
Correct Answer: A,D,E
To enable a new payment type for the Checkout flow, three possible configuration metadata descriptors are needed: * *.pay: This descriptor defines the payment type name, label, description, icon, and handler class. For example, CO.pmts.CreditCard.pay defines the payment type for credit card payments. * *.Edit: This descriptor defines the Visualforce page that is used to edit or update an existing payment of this type. For example, CO.pmts.CreditCard.Edit defines the page that allows editing a credit card payment. * *.New: This descriptor defines the Visualforce page that is used to create a new payment of this type. For example, CO.pmts.CreditCard.New defines the page that allows creating a new credit card payment. Salesforce References: B2B Commerce and D2C Commerce Developer Guide, Payment Configuration Settings