Add a custom action in email

Applies to User roles: Administrator

In the out-of-box system, predefined Smart Email actions can be embedded in the HTML templates for different modules. In addiction, you can tailor the system to add a new custom action for Smart Email.

To add a custom action (for example, an action called "ABC") in the HTML template, following these steps:

  1. Open the HTML template.

  2. In the Expressions tab of the HTML template, add the following line. This is the action display name.

    var ABC_action_label = localscmsg(null, "SmartEmail", "ABC_action_label");

  3. In the HTML Source tab of HTML template, add the following line:

    email_action(ABC,{ABC_action_label},{$RECORD.number},{$RECORD.brief_description},color:#ffffff;font-weight:semibold;text-decoration:none;)

    Note Among the code, the "color:#ffffff;font-weight:semibold;text-decoration:none;" part is optional as it is for the display style of the custom action.

  4. In the MailService._genReplyBody() JavaScript, add the following line to the "default_action_body" array:

    "ABC": _localscmsg(lang, “SmartEmail”, "ABC_default_body")

  5. Add the corresponding scmessage record used in step 2 and step 4.

  6. Modify the mailUtil.calcReplyTo() JavaScript if the logic of the reply email address needs to be changed. See Reply email address for the default "reply to" logic.

  7. Implement the logic of the new custom action as needed. You need to add the action in the

    SmartEmailSMAdapter function sendRecord.