JSMA feedbacks
Overview
What can JSMA feedbacks do for me?
Using the JSMA feedbacks you can create and filter a JSMA feedback
Index
Usage
else if (itemAction === "submitFeedback") { var feedbackName = request.parameter("fn"); var feedbackFirstname = request.parameter("ff"); var feedbackOrderid = request.parameter("fo"); var feedbackEmail = request.parameter("fe"); var feedbackMessage = request.parameter("fm"); var feedbackDate = (new Date()).toJSON(); var feedbackSalutation = request.parameter("fs"); var feedbackPhone = request.parameter("fp"); var portal = getCurrentPortal(); var order = feedbackOrderid && /\d+/.test(feedbackOrderid) ? orders.findById(/\d+/.exec(feedbackOrderid)[0]) : null; var feedback = feedbacks.create(feedbackMessage, feedbackEmail, feedbackDate, feedbackName, feedbackFirstname, feedbackSalutation, feedbackPhone, portal.id, feedbackOrderid); [...] }
Methods
The JSMA feedbacks provides the following methods:
feedbacks.create(message, email, date, name, firstName, salutation, phone, portalId, [orderid])
Creates a JSMA feedback with the given parameters
Example
var feedback = feedbacks.create(feedbackMessage, feedbackEmail, feedbackDate, feedbackName, feedbackFirstname, feedbackSalutation, feedbackPhone, portal.id, feedbackOrderid);
Parameter message (required)
Parameter email (required)
Parameter date (required)
Parameter name (required)
Parameter firstName (required)
Parameter salutation (required)
Parameter phone (required)
Parameter portalId (required)
Parameter orderid (optional)
feedbacks.findByDate(from, to)
Returns feedbacks for the given time frame
Example
var feedbacksJanuary = feedbacks.findByDate('2018-01-01', '2018-01-31');
Parameter from (required)
Parameter to (required)
feedbacks.findByOrder(id)
Returns an array of JSMA feedback for the given order id
Example
var orderFeedback = feedbacks.findByOrder(order.id);