B2B-Commerce-Developer Practice Test Questions

213 Questions


Which handlebars helper expression is used in Salesforce B2B Commerce pages and components to toggle the display of a block of markup?


A. {{#ifStoreSetting 'Field__c'}} ... {{/ifStoreSetting}}


B. {{#ifSetting 'Page.cfg}} ... {{/ifSetting}}


C. {{#ifConfig 'Field__c'}} ... {{/ifConfig}}


D. {{#ifDisplay 'Page.cfg'}} ... {{/ifDisplay}}





C.
  {{#ifConfig 'Field__c'}} ... {{/ifConfig}}

Explanation:

The handlebars helper expression that is used in Salesforce B2B Commerce pages and components to toggle the display of a block of markup is {{#ifConfig ‘Field__c’}} … {{/ifConfig}}. This expression will evaluate the value of the configuration setting with the API name Field__c and render the block of markup if the value is true, or skip it if the value is false. For example, {{#ifConfig 'CO.showMiniCart'}} {{/ifConfig}} will render the mini-cart div only if the configuration setting CO.showMiniCart is true.

Salesforce References: B2B Commerce and D2C Commerce Developer Guide, Handlebars Helpers

Numerous flags when set, have a direct impact on the result set provided by the Global API's. Which conversion flag allows for sObjects to be returned from the Global API's when provided as a Boolean parameter with a value of true?


A. ccrz.ccAPISizing.SKIPTRZ


B. ccrz.ccAPISizing.SOBJECT


C. ccrz.ccAPI.SZ_SKIPTRZ


D. ccrz.ccAPI.SZ_SOBJECT





D.
  ccrz.ccAPI.SZ_SOBJECT

Explanation:

The conversion flag that allows for sObjects to be returned from the Global API’s when provided as a Boolean parameter with a value of true is ccrz.ccAPI.SZ_SOBJECT. This flag indicates that the API should return the raw sObjects instead of the transformed objects that are usually returned by the API. For example, ccrz.ccServiceProduct.getProducts(ccrz.ccAPI.SZ_SOBJECT,true) will return the Product2 sObjects instead of the ccrz__E_Product__c objects. Salesforce

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


A. Calling in with an API version set to lower than 1 will result in an exceptional case where the exception classccrz.BelowMinAPIVersionException will be returned tocallers.


B. There is no need to pass API_VERSION to the Global APIs, and based on the Salesforce B2B Commerce Managed Package version, Global APIs are able to figure out what version of the API to use.


C. The API version is scoped at the Class API level and NOT at the method level.


D. Minimum API_VERSION is 1 and the Maximum API version follows the releases. E.g. The maximum was 4 as of Salesforce B2B Commerce Release-4.5, 5 as of Salesforce B2B CommerceRelease 4.6, etc.


E. 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.





A.
  Calling in with an API version set to lower than 1 will result in an exceptional case where the exception classccrz.BelowMinAPIVersionException will be returned tocallers.

D.
  Minimum API_VERSION is 1 and the Maximum API version follows the releases. E.g. The maximum was 4 as of Salesforce B2B Commerce Release-4.5, 5 as of Salesforce B2B CommerceRelease 4.6, etc.

E.
  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.

Explanation:

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 References: B2B Commerce and D2C Commerce Developer Guide, API Versioning

A query containing a subquery is executed. What is appended to the subquery name as part of its transformation by default in Salesforce B2B Commerce?


A. A subscriber-supplied token


B. "__ccrz"


C. The "*" symbol


D. The letter "S"





B.
  "__ccrz"

Explanation:

A query containing a subquery is executed. By default, in Salesforce B2B Commerce, “__ccrz” is appended to the subquery name as part of its transformation. This is done to avoid conflicts with the standard Salesforce fields and relationships. For example, SELECT Id, Name, (SELECT Id, Name FROMContacts) FROM Account will be transformed to SELECT Id, Name, (SELECT Id, Name FROM Contacts__ccrz) FROM Account__ccrz. Salesforce References: B2B Commerce and D2C Commerce Developer Guide, Query Transformation

Which category can receive signaling from a Lightning Message Channel?


A. only descendents (i.e. children)


B. only direct siblings


C. page (anywhere on it)


D. only ancestors (i.e. parents)





C.
  page (anywhere on it)

Explanation:

A Lightning Message Channel can receive signaling from any component on a page (anywhere on it). A Lightning Message Channel is a service that allows components to communicate with each other across different Salesforce UI technologies, such as Aura, LWC, Visualforce, and Lightning web apps. A component can subscribe to a message channel and receive events that are published by another component on the same or different page. The message channel acts as a mediator that delivers the events to the subscribers. A Lightning Message Channel does not receive signaling only from descendants (i.e., children), only from direct siblings, or only from ancestors (i.e., parents), as these are limitations of event-based communication.

Salesforce References: [Lightning Web Components Developer Guide: Communicate Across Salesforce UI Technologies], [Lightning Web Components Developer Guide: Communicate with Events]

In a B2B Commerce store, which three tasks must a developer complete to implement the use of a third-party service for either tax, shipping, or pricing calculation?


A. Register an Apex class as the integration in the store administration


B. Create a flow to call the external service directly


C. Create an Apex class implementing the appropriate interface.


D. Create a named credential for authentication with an external service


E. Create an Apex class with an invocable method





A.
  Register an Apex class as the integration in the store administration

C.
  Create an Apex class implementing the appropriate interface.

D.
  Create a named credential for authentication with an external service

Explanation:

To implement the use of a third-party service for either tax, shipping, or pricing calculation in a B2B Commerce store, a developer must complete these three tasks: Create an Apex class that implements the appropriate interface for the calculation type. For example, for tax calculation, the developer must implement the sfdc_checkout.CartTax interface and define the getTax method. This method takes a Cart object as an input parameter and returns a list of CartTax objects with the calculated tax amounts.

Create a named credential for authentication with the external service. A named credential specifies the URL of a callout endpoint and its required authentication parameters. The developer can use the named credential in the Apex class to make the callout to the external service and handle the response. Register the Apex class as the integration in the store administration. The developer must specify the Apex class name in the corresponding field for the calculation type. For example, for tax calculation, the developer must enter the Apex class name in the Tax Calculation Integration field. This way, the store can invoke the Apex class to perform the calculation for each cart.

The other options are not valid tasks for implementing the use of a third-party service. Creating a flow to call the external service directly is not supported for B2B Commerce, and creating an Apex class with an invocable method is not required for the calculation integration.

References:

Integrate with External Services

CartTax Interface

Named Credentials

[Store Administration]

The ccUtil apex class in Salesforce B2B Commerce provides numerous utility functions that can be leveraged in subscriber classes. What are two ways to check the input or return data of the Global API's? (2 answers)


A. ccrz.ccUtil.isNotEmpty(Map) andccrz.ccUtil.isNotEmpty(List)


B. ccrz.ccUtil.isNotValid(Map) andccrz.ccUtil.isNotValid(List)


C. ccrz.ccUtil.isValid(Map) and ccrz.ccUtil.isValid(List)


D. ccrz.ccUtil.isEmpty(Map) and ccrz.ccUtil.isEmpty(List)





A.
  ccrz.ccUtil.isNotEmpty(Map) andccrz.ccUtil.isNotEmpty(List)

D.
  ccrz.ccUtil.isEmpty(Map) and ccrz.ccUtil.isEmpty(List)

Explanation:

The ccUtil apex class provides two methods to check the input or return data of the Global API’s: ccrz.ccUtil.isNotEmpty(Map) and ccrz.ccUtil.isEmpty(Map). These methods return true if the map is not null and contains at least one entry, or if the map is null or empty, respectively. Similarly, ccrz.ccUtil.isNotEmpty(List) and ccrz.ccUtil.isEmpty(List) return true if the list is not null and contains at least one element, or if the list is null or empty, respectively. These methods are useful for validating the input parameters or the output results of the Global API’s.

Which three files are required for a deployable Lightning Web Component called displayMyData that will fetch and display data?


A. displayMyData.css


B. displayMyData.js-meta.xml


C. displayMyData.js


D. displayMyDataController.cls


E. displayMyData.html





A.
  displayMyData.css

B.
  displayMyData.js-meta.xml

E.
  displayMyData.html

Explanation:

For a deployable Lightning Web Component likedisplayMyData, the required files include the component's CSS file (displayMyData.css) for styling, the metadata configuration file (displayMyData.js-meta.xml) for defining the component's configuration and properties, and the template file (displayMyData.html) for the component's HTML structure. The JavaScript file (displayMyData.js) contains the business logic but is not listed as an option here. For deployment, these files are essential. Refer to the Salesforce LWC documentation for deployment requirements:Salesforce LWC Deployment Documentation.

Which Lightning web component path allows a developer to view or edit a record while maintaining control over specifying its layout and set of fields?


A. lightning-record-edit-form


B. lightning-record-imperative


C. lightning-record-view-form


D. lightning-record-form





A.
  lightning-record-edit-form

Explanation:

The lightning-record-edit-form component allows a developer to view or edit a record while maintaining control over specifying its layout and set of fields. This component provides a way to create forms that respect the field-level security and layout configuration defined in the Salesforce metadata. The developer can use lightning-inputfield components inside the form to display and edit the fields of a record. The other options are incorrect because they either do not allow editing the record, do not respect the metadata configuration, or do not exist as valid component paths. References: lightningrecord-edit-form | Lightning Web Components Developer Guide

A developer used slots to pass content from one Lightning Web Component to another. How can they access the. DOM for what was passed to those slots?


A. Call this.template.querySelector() and this.template.querySelectorAll()


B. Call this.querySelector() passing an id


C. Call this.querySelector() and this.querySelectorAll()


D. Call this.template.querySelector() passing an id





A.
  Call this.template.querySelector() and this.template.querySelectorAll()

Explanation:

In Lightning Web Components, to access the DOM elements within the component's template, including those passed into slots, developers use this.template.querySelector()andthis.template.querySelectorAll(). These methods allow for querying the component's local DOM. Direct DOM manipulation or querying outside the component's template is discouraged to maintain component encapsulation and security. For more information, see the Salesforce LWC documentation on accessing the DOM:Salesforce LWC DOM Access Documentation.

What target does a developer need to set in the js-meta.xml file when creating a custom LWC component for use in the Checkout Flow?


A. lightning_FlowScreen


B. lightning__CheckoutFlow


C. Iwe__FlowComponent


D. lwe__flow





C.
   Iwe__FlowComponent

Explanation:

When creating a custom Lightning Web Component (LWC) for use in the Checkout Flow, a developer must set the target in the js-meta.xml file to lwc__FlowComponent. This target specifies that the LWC is intended for use within the flow component framework, allowing it to be utilized specifically in the context of Salesforce Flows, including those used in the checkout process. Salesforce documentation on developing custom LWCs for various targets would detail this requirement, ensuring that developers understand how to correctly package and deploy their components for the intended use case.

Which HTML element can be used as a root tag for a Lightning Web Component's HTML file?


A.


B.


C.


D.