Salesforce Certified B2C Commerce Developer Questions and Answers
Which snippet works correctly when updating the package.json file to point to the hook file for a cartridge?
A developer is asked to create a controller endpoint that will be used in a client-side AJAX request. Its purpose is to display updated information to the user when the request is completed, without otherwise modifying the appearance of the current page.
According to SFRA practices, which method best supports this objective?
To ensure SFRA best practices and protect against request forgery, the developer introduced CSRF token generation in the customer address form.
< form ... action= " submit " >
< input name= " ${dw.web.CSRFProtection.getTokenName()} "
value= " ${dw.web.CSRFProtection.generateToken()} " >
...
< the rest of the Form Fields >
....
< /form >
To implement CSRF protection when the form is submitted, the developer needs to introduce the CSRF validation using one or both of these methods as applicable:
validateRequest
validateAjaxRequest
Where in the code does the developer need to add this CSRF validation check?
Business Manager has the configuration:
• Active Log category is " root "
• Log level of WARN
The code below is executing:
varlog=Logger.getLogger( " products " );
Using this information, what will be written to the log?
The Home-Show route uses this middleware chain:
server.get( ' Show ' ,consentTracking.consent,cache.applyDefaultCache,
function(req,res,next) {
// base code here
}
);
The developer added Home.js in another cartridge, which is before the original cartridge in the cartridge path, to extend that route but it does not have the middleware chain:
server.append( ' Show ' ,function(req,res,next) {
// custom code here
});
Assuming the code is correct on both functions, what is the expected result?
A developer wants to add a link to the My Account page.
What is the correct code to accomplish this?
A developer is asked to periodically create a CSV file in a WebDAV folder to hold the orders information of the last 30 days.
What are the appropriate actions to implement such a requirement?
Given the sandbox with:
• Service configured and assigned to its profile and credential
• A code version that uses that service
And given the requirement to limit the number of success or error calls the code can perform to a restricted number of calls per second. Which configuration should the developer perform?
A merchant asks a developer to create a Cache Partition for the home page, so that when the home page is edited, only the home page cache is cleaned.
Given the above requirement, where should the developer create that partition in Business Manager?
A developer uses the call() instance method of dw.svc.Service to invoke a web service and implemented the callback methods defined by the dw.svc.ServiceCallback class.
Which callback method is required only when invoking a SOAP service?
What is the expected result when extending a route without the middleware chain?
A developer is working on a new site for the U.S. based on an existing Canadian site. One of the requirements is a change to the address form. The current Canadian form has an < options > list with the correct two-letter abbreviation for the provinces.
The U.S. requirements are to:
Have an < options > list with the correct two-letter abbreviation for the states in place of the province field.
Set the U.S. site locale.
Add the options list field definition to the XML file.
How should the developer set up the files before making the required edits?
A client has a requirement to allow users on the Storefront to filter by a newly created attribute. Which is necessary to achieve this?
The developer created a new Storefront category in storefront-catalog-m-en, but when viewing the Storefront site, the category is not visible.
Why might the categories not be visible?
Reference the following code snippets that allow a form to function correctly.
Form definition (newsletter.xml):
< ?xmlversion= " 1.0 " ? >
< formxmlns= " " >
< fieldformid= " email " label= " Email: " type= " string "
mandatory= " true " max-length= " 50 " / >
< /form >
Controller snippet:
varnewsletterForm=server.forms.getForm( ' newsletter ' );
res.render( ' NewsletterTemplate ' ,{newsletterForm:newsletterForm});
Template snippet:
< form action= " ${URLUtils.url( ' Newsletter-Submit ' )} " method= " POST "
< isprint value= " ${EXPRESSION.attributes} " encoding= " off " / > >
< input type= " input " id= " email "
< isprint value= " ${EXPRESSION.email.attributes} " encoding= " off " / > >
< button type= " submit " > Submit < /button >
< /form >
Which code should a developer insert at the EXPRESSION placeholder in the ISML template snippet above to have the form work as expected?
A developer is asked to write a log containing the ID and name of the product with a variable named myProduct.
Which snippet of code should be used?
Given a sandbox with an active slot configuration with the following specifications:
Content type set to product
With some product configured
With the following rendering template:slots/product/product_1x2.isml
Correctly enabled and scheduled
And given the code contained in the selected rendering template:
< isif condition= " ${!empty(slotcontent)} " >
< isloop iterator= " ${slotcontent.content} " alias= " product " >
< div class= " product " >
< isprint value= " ${product.getID()} " > < br / >
< isprint value= " ${product.getName()} " > < br / >
< /div >
< /isloop >
< /isif >
Is an additional action needed for this to work as intended?
Given the following OCAPI definitions, which permission or permissions apply?
{
" resource_id " : " /sites/*/coupons/* " ,
" methods " :[
" put "
],
" read_attributes " : " (**) " ,
" write_attributes " : " (**) "
}
To build the SFRA code to a developer sandbox for the first time, which build steps should the developer perform for the site to appear and function as designed?
A developer has custom debug statements in a script, but the messages are not showing up in the Storefront Toolkit Request Log.
Which step needs to be completed to get the messages to appear in the Request Log?
A developer is using the Script Debugger to troubleshoot an issue. They observe that the debugger is not able to resolve a specific breakpoint on one of the scripts. What is a possible reason for this issue?
A merchant uploads an image using the Content Image Upload module of Business Manager.
Which module can the merchant use to display the image on the Storefront?
A developer is asked to implement a simple call to an authentication-protected REST web service.
Which configuration is valid?
Which method should a developer use to create a service instance that will call a remote web service?
A developer is configuring Payment Methods on a storefront. Which of the following considerations should be kept in mind while configuring payment methods?
There are three logging categories: category1, category1.eu, and category1.us. In Business Manager, category1 is enabled for WARN level and no other categories are configured. All custom log targets are enabled.
The code segment below executes.
varlogger=Logger.getLogger( " loggerFile " , " category1.eu " );
logger.warn( " This is a log message " );
What is the result?
Given the SFRA Controller below:
01varserver=require( ' server ' );
02varcache=require( ' */cartridge/scripts/middleware/cache ' );
03
04server.get( ' Show ' ,cache.applyDefaultCache,function(req,res,next) {
05viewData={name: ' my string ' };
06res.render( ' /pages/mypage ' ,viewData);
07next();
08});
09
10module.exports=server.exports();
Why would a JavaScript debugger, that is stopped at line 06, fail to show the viewData variable in the inspection tool?
A developer is tasked with creating a new payment method in Business Manager. What is the first step the developer should take?
A developer needs to implement a new feature that requires the use of a custom attribute. What is the first step the developer should take?
A merchant wants customers to be able to order gift vouchers via their site. Since they can issue an unlimited number of these digital vouchers, this item should be available to sell at all times.
How can a developer use Business Manager to ensure that the gift vouchers are always available?
A developer wants to configure multiple products that should only be sold as a group. It should not be possible for buyers to buy these products individually. How should the developer configure the products?
A client has a requirement to allow users on the Storefront to filter by a newly created attribute.
After creating the search refinement, what else is necessary to achieve this?
A developer is working on a feature that requires the use of a third-party API. What is the best practice for handling API responses in Salesforce B2C Commerce?
What should a developer do to ensure that the gift vouchers are always available?
A merchant has a new requirement to accept American Express credit cards on its Storefront. A credit card payment method already exists.
Which step must a developer take in Business Manager to achieve this?
A developer needs to display a products list of their " Women Dresses " category in a new web application, independent of their main B2C Commerce site. This custom listing page needs to be styled differently from the existing one, as per marketing requirements. Which B2C Commerce tool should the developer use to collect the necessary information?
A merchant wants to obtain an export file that contains all the products assigned to their Storefront catalog. They do not know how to achieve this easily without manual processing, so asked their developer to help generate this. The merchant ' s instance setup is as follows:
• They have one Master catalog and one Storefront catalog.
• Some, but not all, of the products in the Master catalog are assigned to categories within the Storefront catalog.
Which method allows the developer to generate the export for the merchant?
A developer customized the Cart-Show controller route with a LINK cartridge that adds social media data. There is a new requirement to add a dataLayer object to the Cart-Show controller route.
How should the developer achieve this to ensure that no code change will be needed if the client decides to remove the LINK cartridge?
A developer configures the dw.json file and needs to fill in the necessary parameters to complete the task.
Which parameter is required when using npm scripts?
What step should a developer take to troubleshoot code changes not appearing on the Storefront?
A developer needs to update the package.json file so that it points to the hook file for a cartridge, using the hooks keyword.
Which snippet works correctly when added to the file?
The client provides the system integrator with translation messages for the newly added " French " ( " fr " ) locale.
What is the correct folder to store the associated.propertiesfiles?
A developer needs to perform the same additional checks before completing multiple routes in a custom controller, in order to decide whether to render a template or redirect the user to a different page.
According to SFRA best practices, what is the correct approach to improve code reusability in this scenario?
A client that sells to multiple countries in Europe needs to disable Apple Pay for Denmark.
Which Business Manager module is used to achieve this requirement?
The developer has been given the following business requirement:
The shipping method, " Free Standard Ground Shipping " has an exclusion for products with ' category equals or is child of electronics-televisions. '
The marketing department has scheduled a sale offering a " Free Standard Ground Shipping " method for brand XyzTv televisions for the next 3 months.
What method accomplishes this while following best practices?
Given a NewsletterSubscription custom object that has a key attribute named email of type String, what is the correct syntax to create the NewsletterSubscription custom object?