Salesforce B2B Commerce for Developers Accredited Professional (AP-202) Exam Practice Test

Page: 1 / 14
Total 221 questions
Question 1

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?

A)

B)

C)

D)



Question 2

What are two considerations to keep in mind when including additional JavaScript files in a Lightning web component?



Answer : B, C

When including additional JavaScript files in a Lightning web component, a developer should keep in mind two considerations: the files must be ES6 modules and must have names that are unique within the component's folder and a module can export named functions or variables. The files must be ES6 modules because LWC uses ES6 modules as the standard for modular JavaScript code. The files must have names that are unique within the component's folder because LWC uses the file name as the module identifier and does not allow duplicate identifiers. A module can export named functions or variables because LWC supports named exports, which allow a module to export multiple values with different names. Each additional file does not need a corresponding .js-meta.xml file, as this is only required for the main JavaScript file of the component. Additional JavaScript files should not be minified before deployment, as this is not necessary or recommended for LWC. Salesforce Reference: [Lightning Web Components Developer Guide: Include JavaScript Files], [Lightning Web Components Developer Guide: ES6 Modules]


Question 3

Which three statements are true about Global API versioning? (3 answers)



Answer : A, D, E

Three statements that are true about Global API versioning are:

Calling in with an API version set to lower than 1 will result in an exceptional case where the exception class ccrz.BelowMinAPIVersionException will be returned to callers. This exception indicates that the API version is not supported by the framework and the caller should use a higher API version.

The API version is scoped at the Class API level and NOT at the method level. This means that all the methods in a class will use the same API version that is specified by the caller. For example, if the caller passes an API version of 4 to ccrz.ccServiceProduct.getProducts(), then all the other methods in ccrz.ccServiceProduct will also use API version 4.

Calling in with an API version set to more than current maximum will result in exception case where the exception class ccrz.ExceedsMaxAPIVersionException will be returned to callers. This exception indicates that the API version is not supported by the framework and the caller should use a lower API version. Salesforce Reference:B2B Commerce and D2C Commerce Developer Guide,API Versioning


Question 4

A developer needs to create an event listener on a parent component programmaticallv. With the script below, what should replace the text ?



Answer : C

To create an event listener on a parent component programmatically, the developer should use the following line of code:

this.template.addEventListener('notification', this.handleNotification);

This line of code adds an event listener to the template element of the parent component, which is the root element that contains all the child elements. The event listener listens for an event named 'notification', which is a custom event that can be dispatched by any child component. The event listener invokes a method named handleNotification, which is an arrow function defined in the parent component class. The handleNotification method receives the event object as a parameter and can perform any logic based on the event data. The other lines of code are either incorrect or incomplete. Salesforce Reference: Lightning Web Components Developer Guide: Communicate with Events, Lightning Web Components Developer Guide: Create and Dispatch Events


Question 5

What is default behavior for how theSalesforce B2B Commerce Global APIs transform Salesforce data?



Question 6
Question 7

In checkout, what event should the developer's code listen for in order to help troubleshoot and respond to actions?



Answer : D

To help troubleshoot and respond to actions in checkout, the developer's code should listen for CommerceDiagnosticEvents. CommerceDiagnosticEvents is an event that is fired by Salesforce B2B Commerce when an error occurs in the storefront. CommerceDiagnosticEvents contains information about the error, such as error code, error message, error type, and error details. CommerceDiagnosticEvents can be subscribed by other components or services that want to handle or display the error information in different ways. The developer's code can listen for CommerceDiagnosticEvents using anaura:handlertag in Aura Components or an @wire decorator in Lightning web components. The developer's code can also use the event information to perform custom logic or actions based on the error, such as logging, reporting, or notifying. CommerceBubbleEvents is not an event that the developer's code should listen for in checkout, as it is not related to troubleshooting or responding to actions. CommerceBubbleEvents is an event that is fired by Salesforce B2B Commerce when a user interacts with a bubble component in the storefront. A bubble component is a user interface element that displays information or options in a pop-up window when clicked or hovered over. CommerceBubbleEvents contains information about the user interaction, such as bubble name, bubble type, and bubble value. CommerceErrorEvents is not an event that the developer's code should listen for in checkout either, as it is not related to troubleshooting or responding to actions. CommerceErrorEvents is an event that is fired by Salesforce B2B Commerce when a validation error occurs in the storefront. CommerceErrorEvents contains information about the validation error, such as field name, field label, and error message. CommerceActionEvents is not an event that the developer's code should listen for in checkout either, as it is not related to troubleshooting or responding to actions. CommerceActionEvents is an event that is fired by Salesforce B2B Commerce when a user performs an action in the storefront. CommerceActionEvents contains information about the user action, such as action name, action type, and action parameters. Salesforce Reference:B2B Commerce Developer Guide: Handle Errors,B2B Commerce Developer Guide: Handle User Interactions with Bubble Components,B2B Commerce Developer Guide: Handle Validation Errors,B2B Commerce Developer Guide: Handle User Actions


Page:    1 / 14   
Total 221 questions