Deal of The Day! Hurry Up, Grab the Special Discount - Save 25% - Ends In 00:00:00 Coupon code: SAVE25
Welcome to Pass4Success

- Free Preparation Discussions

Salesforce CCM-101 Exam - Topic 10 Question 84 Discussion

A Newsletter controller contains the following route:Server.post('Subscribe', function (req,res,next){var newsletterForm = server.forms.getForm('newsletter');var CustomObjectMgr = require('dw/object/CustomObjectMgr');if(newsletterForm.valid){try{var CustomObject =CustomObjectMgr.createCustomObejct('NewsletterSubscription', newsletterform.email.value);CustomObject.custom.firstName = newsletterForm.fname.value;CustomObject.custom.lastName = newsletterForm.lname.value;-} catch(e){//Catch error here}}next();});Assuming the Custom Object metadata exists, why does this route fail to render the newsletter templatewhen the subscription form is correctly submitted?
D) The Custom Object creation is not wrapped in a Transaction.
A) Custom Objects can only be created by Job scripts
B) The Subscribe route is missing the server.middleware.httpt middleware.
C) The CustomObjectMgr variable should be declare outside of the route.

Salesforce CCM-101 Exam - Topic 10 Question 84 Discussion

Actual exam question for Salesforce's CCM-101 exam
Question #: 84
Topic #: 10
[All CCM-101 Questions]

A Newsletter controller contains the following route:

Server.post('Subscribe', function (req,res,next){

var newsletterForm = server.forms.getForm('newsletter');var CustomObjectMgr = require('dw/object/CustomObjectMgr');

if(newsletterForm.valid){

try{

var CustomObject =

CustomObjectMgr.createCustomObejct('NewsletterSubscription', newsletterform.email.value);

CustomObject.custom.firstName = newsletterForm.fname.value;

CustomObject.custom.lastName = newsletterForm.lname.value;-

} catch(e){

//Catch error here

}

}

next();

});

Assuming the Custom Object metadata exists, why does this route fail to render the newsletter template

when the subscription form is correctly submitted?

Show Suggested Answer Hide Answer
Suggested Answer: D

Contribute your Thoughts:

0/2000 characters

Currently there are no comments in this discussion, be the first to comment!


Save Cancel