JSMA feedback
Overview
What can JSMA feedback do for me?
Using the JSMA feedback you can access customer feedback for further utilization
Index
Usage
UsersApi.prototype.doSubmitFeedback = function () { var result = { status : "OK" }; var feedback = request.parameter("feedback"); var portal = portals.current; var orderId = feedback.orderId; var order = orders.findById(orderId); [...] var feedbackEntry = feedbacks.create(feedback.message, feedback.email, (new Date()).toJSON(), feedback.lastName, feedback.firstName, feedback.gender, feedback.phone, portal.id, orderId); var mailTemplateBodyName = portal.get("rhino.users.feedbackConfirmationMailBody"); var mailTemplateSubjectName = portal.get("rhino.users.feedbackConfirmationMailSubject"); var mailServiceTemplateBodyName = portal.get("rhino.users.feedbackServiceMailBody"); var mailSender = portal.get("service.mail"); var mailSenderName = portal.get("service.mailSender"); var mailTemplateBody = contents.findByName(mailTemplateBodyName); var mailTemplateSubject = contents.findByName(mailTemplateSubjectName); var mailServiceTemplateBody = contents.findByName(mailServiceTemplateBodyName); var recipient = feedback.recipient || mailSender; //send feedback confirmation mail if (mailTemplateBody !== null && mailTemplateSubject !== null && mailServiceTemplateBody !== null) { setCurrentFeedbackForRequest(feedbackEntry); //send mail to customer mail.send(feedback.email, mailTemplateSubject.content, mailTemplateBody.content, mailSenderName, mailSender, null, portal); //send mail to service mail.send(recipient, mailTemplateSubject.content, mailTemplateBody.content + mailServiceTemplateBody.content, mailSenderName, mailSender, null, portal); //update order history if (order) { order.addHistoryEntry(mailTemplateBody.content + mailServiceTemplateBody.content); } setCurrentFeedbackForRequest(null); } result.feedbackId = feedbackEntry.id; return result; };
Methods
The JSMA feedback provides the following methods:
date feedback.date
Returns the date of submission of a feedback
Example
var feedbackDate = feedback.date;
string feedback.email
Returns the e-mail address used to submit a feedback
Example
var feedbackEmail = feedback.email;
string feedback.firstName
Returns the first name used to submit a feedback
Example
var feedbackFirstName = feedback.firstName;
string feedback.message
Returns the message field of a submitted feedback
Example
var feedbackMessage = feedback.message;
string feedback.lastName
Returns the last name used to submit a feedback
Example
var feedbackLastName = feedback.lastName;
int feedback.orderId
Returns the order id associated with the feedback
Example
var feedbackOrderId = feedback.orderId;
string feedback.phone
Returns the phone number of a submitted feedback
Example
var feedbackPhone = feedback.phone);
portal feedback.portal
Returns the portal a feedback has been submitted in
Example
var feedbackPortal = feedback.portal;
int feedback.portalId
Returns the ID of the portal a feedback has been submitted in
Example
var feedbackPortalId = feedback.portalId;
string feedback.salutation
Returns the salutation of a submitted feedback
Example
var feedbackSaluation = feedback.salutation;