The JSMA customer provides functionality for handling customers
What can JSMA customer do for me?You could easily use the JSMA customer to edit a customer |
Here is an example on how to write data to a JSMA customer:
... var feedbackMailBody = mailTemplateBody.content; mail.send(feedback.email, mailTemplateSubject.content, feedbackMailBody, mailSenderName, mailSender); mail.send(mailSender, mailTemplateSubject.content, feedbackMailBody + mailServiceTemplateBody.content, mailSenderName, mailSender); if (customer) { customer.addHistoryEntry(feedbackMailBody + mailServiceTemplateBody.content); } ... |
Here is an example on how to read data from a JSMA customer:
... var loginname = customer.loginName(); ... |
The JSMA customer provides the following methods:
With this function you can check whether a customer is active
... if (customer.active === true) { ... } ... |
Adds an entry to a customer's IFE history. This serves as a documentation tool for communication as well as the customer's interaction with the website (e.g. creating/saving/deleting projects).
... var feedbackMailBody = mailTemplateBody.content; mail.send(feedback.email, mailTemplateSubject.content, feedbackMailBody, mailSenderName, mailSender); mail.send(mailSender, mailTemplateSubject.content, feedbackMailBody + mailServiceTemplateBody.content, mailSenderName, mailSender); if (customer) { customer.addHistoryEntry(feedbackMailBody + mailServiceTemplateBody.content); } ... |
Returns a boolean value depending on whether the customer is confirmed
... if (customer.confirmed === true) { ... } ... |
Returns the date of when the customer was confirmed
... customer.confirmedDate ... |
Returns the display name of the customer
... customer.displayName ... |
Returns the e-mail of the customer
... customer.email ... |
Returns an object containing the errors of a customer
... customer.errors ... |
Returns an array of the flex attributes of a customer
... customer.flexAttributes ... |
Returns the value of key as string or null if no value is set under the key.
... customer.get(key) ... |
The key to be looked up in the flexAttributes of the customer.
Returns a boolean value depending on whether key is present for a given customer
... customer.has(key) ... |
The key to be checked in the flexAttributes of the customer.
Returns the ID of a customer
... customer.id ... |
Increments the vale of a given key by one.
... customer.increment(key) ... |
The key to be incremented in the flexAttributes of the customer.
Returns the date of the last login of the customer
... customer.lastLogin() ... |
With this function you can login a customer
... customer.login ... |
Returns the number of logins of a customer
... customer.loginCount ... |
Returns the numer of login failuers of a customer
... customer.loginFailureCount ... |
Returns the login-name of a customer
... customer.loginName ... |
With this function you can logout the customer
... customer.logout() ... |
Returns an arry of order-ids that belong to the customer
... customer.orderIds ... |
Returns the portal the customer belongs to
... customer.portal ... |
Removes the key from the flexAttributes of the customer
... customer.remove(key) ... |
The key to be removed from the flexAttributes of the customer.
Sets the value of a specified key for a given customer.
... customer.set(key, value, [options]) ... |
The key to be set in the flexAttributes of the customer.
The value to be set for the key
Activates a customer
... customer.setActive(true) ... |
Sets the confirmed-value of a customer
... customer.setConfirmed(true) ... |
Sets the display-name of a customer
... customer.setDisplayName(name) ... |
Sets the e-mail of a customer
... customer.setEmail(email) ... |
Sets the login-name of a customer
... customer.setLoginName(name) ... |
Sets the password of a customer
... customer.setPassword(password) ... |
The new password. It is hashed using bcrypt and the hash is saved in the database.
Validates the given password
... customer.validatePassword(password) ... |
The password to be checked. It is hashed using bcrypt and the hased value is compared to the one in the database.