AP-202 Practice Questions
Prepare for AP-202 with more than an answer.
- Exam fee
- $150 USD
- Level
- Intermediate
- Valid for
- Details to be announced in 2025
Domains covered on the exam 6
- Checkout Flow Development10%
- Reference Implementations15%
- Basic Lightning Web Component Development20%
- Advanced Lightning Web Component Development30%
- Data Management15%
- Error Handling and Diagnostics10%
- 1
A developer has created a custom LWC to be used on the B2B Commerce home page. The component needs to access the ID of the current
WebStore. Which is the standard, most efficient way for the LWC to obtain theWebStoreId?Show answer details
Correct answer: D
The B2B Commerce framework provides specific scoped modules to access contextual information without needing an Apex call. The
@salesforce/commerce/contextmodule is designed to provide context about the current store, including thewebstoreId. This is the most direct, efficient, and standard method for an LWC to become aware of the store it's running in. - 2
What are the primary responsibilities of the
ccrz.cc_hk_Pricingservice extension class in the B2B Commerce (CloudCraze) framework? (Select TWO)Show answer details
Correct answer: A, B
- 3
A developer is writing a Jest test for a Lightning Web Component that displays product information. The component uses the
@wireservice to call an Apex methodgetProductDetails. How should the developer mock the data returned by the wired Apex method in the Jest test?Show answer details
Correct answer: B
The standard pattern for testing wired Apex methods in Jest is to import the adapter itself. The testing framework provides a mock version of the wire service that includes an
emitfunction. The test can then call.emit(mockData)to simulate the wire service pushing data to the component. This allows the developer to test how the component renders and behaves with the mocked data without making a real server call. - 4
True or False: The B2B Commerce Search index is updated in real-time, meaning that a new product becomes searchable the instant its
IsActiveflag is set to true.Show answer details
Correct answer: B
False. The B2B Commerce search index is not updated in real-time. After making changes to products, catalogs, or price books, an administrator must manually run a search index rebuild process from the store's administration settings. This process can take some time to complete depending on the size of the catalog.
- 5
During checkout, a developer needs to validate that the total quantity of a specific product category ('Hazardous Materials') does not exceed a limit defined on the buyer's Account record. This validation must prevent the user from proceeding to the payment step. Where should this validation logic be implemented?
Show answer details
Correct answer: C
The checkout process is controlled by a Flow. Therefore, the most appropriate place to add server-side validation is within the checkout flow itself. A developer can create a custom Apex invocable action that accepts the cart ID, performs the necessary queries to sum the quantities by category and check the Account limit, and returns a boolean result. A Decision element in the flow can then use this result to either direct the user to an error screen or allow them to proceed.
- 6
A B2B Commerce storefront for 'Quantum Robotics' is experiencing slow load times on the Product Detail Page (PDP), especially for products with numerous specifications and downloadable assets. A performance audit reveals that an Apex controller for a custom LWC is making multiple, sequential SOQL queries to fetch product attributes, related documents, and entitlement policies. Which of the following refactoring approaches offers the most significant performance improvement?
Show answer details
Correct answer: B
The most effective way to reduce database round-trips and improve Apex performance is to aggregate multiple queries into a single query. Using parent-child subqueries allows the retrieval of the product, its attributes, documents, and policies in one efficient database operation, minimizing query time and CPU usage. Caching would help subsequent loads but doesn't fix the initial slow load. Pagination is for handling large record sets, not for reducing multiple distinct queries. Asynchronous calls would not reduce the total server-side processing time for a single user's request.
- 7
A developer at 'Momentum Manufacturing' needs to build a custom LWC that allows buyers to reorder from a previous cart. The component must display a list of past carts and, upon selection, use the
B2B ReorderAPI to create a new cart with the same items. What is the correct sequence of API calls and actions to implement this functionality?Show answer details
Correct answer: B
The correct approach is to first retrieve the historical
WebCartrecords for the user. The B2B Commerce API provides a specificB2BReorderApex class with areordermethod designed for this purpose. This method takes the original cart ID as input and handles the creation of the new cart and its items, returning the ID of the new cart. Finally, the user should be programmatically navigated to the new cart page. Other options misuse the APIs or suggest incorrect methods. - 8
A consultant is designing a solution for 'Apex Industrial Supplies' that requires different checkout experiences for two distinct buyer groups: 'High-Volume Resellers' and 'Standard Contractors'. The 'High-Volume Resellers' need a streamlined, one-page checkout, while 'Standard Contractors' require a multi-step process with a shipping address verification step. How should this be configured in B2B Commerce?
Show answer details
Correct answer: D
B2B Commerce natively supports assigning different checkout flows to different buyer groups. The correct method is to build the distinct flows required in Flow Builder and then use the B2B Commerce administration settings within the store to map each flow to the appropriate buyer group. This is the most scalable and maintainable solution that leverages standard platform functionality.
- 9
A developer is tasked with extending the standard B2B Commerce payment processing logic. The requirement is to perform a fraud check with an external service before authorizing the payment. Which reference implementation should the developer extend to incorporate this custom logic?
Show answer details
Correct answer: C
The
GatewayProviderinterface is the correct reference implementation for integrating payment gateways. To add a custom fraud check, a developer would create a custom Apex class that implements this interface. Within theauthorizemethod of this class, the developer would first make a callout to the external fraud service and then, if the check passes, proceed with the standard payment authorization logic. - 10
To improve the user experience on the Product List Page (PLP), a developer has been asked to add a 'Compare' feature. This feature requires communication between multiple, independent
productTileLWCs and a centralproductCompareLWC located in the page header. Which two of the following are the most appropriate and scalable mechanisms for theproductTilecomponents to notify theproductComparecomponent when a product is selected for comparison? (Select TWO)Show answer details
Correct answer: B, D
