Email Templates
You can configure MYOB Acumatica to automatically send template-based emails to users on different occasions. For example, a new user may receive an email with the user credentials to be used to access the system, or a user can receive a notification that a record has been approved and needs further processing. Also, you can use template-based emails in mass mailings. For an example of a notification template for notifications about changes to a case made through the Customer Portal, see To Add a Notification Template for Changes in the Contents of a Case.
In addition to the standard set of templates that comes with MYOB Acumatica, you can create new templates for notifications or emails by using the Email Templates (SM204003) form. On the Email Preferences (SM204001) form, you can specify the default templates for welcoming new users and for helping users with sign-in and password recovery.
Using Placeholders in Email Templates
To specify the recipients of an email on the Email Templates (SM204003) form, you can use the data fields (as placeholders) that hold email addresses; these data fields should be separated with semicolons. Their values are retrieved when the system sends the email. In the To, CC, and BCC boxes, you can specify an email address as follows:
- A specific user in the system. To do this, you open the lookup table, search for the needed username, and double-click it. The system adds it as EMAIL((<username>));.
- A specific email address that you manually type in the box, such as sales@acumatica.com.
- A placeholder for an email address stored in the system, which you add by opening the lookup table and going to the Screen Fields tab. On the tab, you find the needed database field in a node of the Entity node. The contents of the node are provided by the data entry form or generic inquiry form selected in the Screen box of the form. This adds the placeholder associated with the database field, for example, ((customer.DefContactID.EMail)).
In the body of the email template (on the Message tab), you can also insert as a placeholder any data field of the data entry form or generic inquiry form selected in the Screen box of the form. To do this, you click on the formatting toolbar and select the data field in the appropriate node.
Suppose that you want the system to insert a user-defined email signature from the User Profile (SM203010) form into all email notifications of the signed-in user. To accomplish this, you click on the formatting toolbar of the Message tab, and then double-click Email Signature in the General Info node. The system adds ((GeneralInfo.MailSignature)) to the body of the email template. When a signed-in user sends an email notification, the system includes the user-defined email signature in the body of the message.
For email templates used as subscribers of business events, you can insert as a placeholder any data field whose value was retrieved before the business event occurred. To do this, you click
on the formatting toolbar and select the needed data field. You can use this ability to demonstrate how the value of the data field has changed—for example, if a case’s status has changed from New to Open.Including Document Details
You can include information from document detail lines in notifications. If you want to
simply list document details, you add the foreach view="view_name"
loop to
the body of the notification template in HTML format. For instance, you can use the
following construction for notifications about opportunities.
<foreach view="Products">
((Products.InventoryID)) - ((Products.Quantity)) - ((Products.CuryExtPrice)) <br>
</foreach>
If you want to list details in a table or as a numbered or unordered list, you can use the
data-foreach-view="view_name"
attribute. The attribute indicates that the
markup that is embedded inside the tag will be repeated for all document lines, as shown in
the following example for notifications about opportunities. The attribute is supported for
the following HTML tags: <tr>
, <td>
,
<li>
, and <div>
. In the following example, when
the email content is generated, all tags included in the <table>
tag are
repeated for every record in the "Products"
view.
<table border="1" >
<tbody>
<tr data-foreach-view="Products" >
<td class="warncell">((Products.InventoryID)) </td>
<td class="warncell">((Products.Quantity)) </td>
<td class="warncell">((Products.CuryExtPrice)) </td>
</tr>
</tbody>
</table>
"data-foreach-view"
and
foreach
attributes in the notification templates used for business
events, but leave empty the view name in the attribute: <tr
data-foreach-view="">
or foreach view=""
. If you specify the
view name in this attribute, the system will insert the values of only the first record in
the email.