One of the many useful features of the Acumatica xRP Platform is the built-in notification engine.
Using automation steps and email processing, you can trigger emails to be sent to users when something happens, or an action is needed.
When we started using Acumatica as our CRM and support platform, notifications became an integral part of the process. One thing we quickly found out is that we could provide value to our customers by helping them build better templates that were clear and practical – but also branded and nice looking.
Here is how we did it.
Acumatica Notification Template Editor
Acumatica includes an integrated rich text editor for templates. Both screens SM204003 and SM205040 use the same editor, and it supports the use of special field tags that are placeholders to be filled with values from the related documents before being sent.
Content can be edited in a visual WYSIWYG mode, but you can switch to an HTML mode to edit the markup directly. If we would like to create good looking emails, we need to use HTML.
Using Acumatica’s integrated HTML editor can be simple enough, if you just want to change the size of a sentence or add a little color, but it can quickly become difficult to work if you need to design good-looking templates from scratch. It is also not ideal if you want to build complex email formats that are also responsive and universally compatible with email readers.
If we could find a way to easily design our templates and build the required HTML markup, we could just paste it into the Acumatica editor.
This is where email building frameworks come into play.
Most email template frameworks work in a similar way: they provide a baseline platform that makes it easy to design email content using simple proprietary definitions of blocks and columns, then they generate the required HTML markup. Due to the variety and non-standardized world of email clients, they all use some smart tricks to make the rendered emails look as close as possible to the original design in any email reader.
There are several tools out there that we can use to design and build email templates. Currently, we are using mjml (by MailJet). Other similar tools we have tested are Foundation for Emails (by Zurb) and HEML (by Sparkpost).
Building a Base Template
The fastest way to start building a template is to install the MJML native application. This tool includes a live preview of the template as you work on it.
The main idea of the framework is to build templates from simple building blocks. The main blocks are: mj-body, mj-section and mj-column. Content then comes as different types of components where the most common one is mj-text. For more references, you can check mjml’s documentation.
If you add images, you need to use full URL because they need to be accessible from the email client. Acumatica won’t attach them to the email.
When building the email content, you can add placeholder variables depending on the Acumatica screen related to the template. To get the name of the data field, you can use the INSERT->DATAFIELD command. This shows a list of related DACs and available fields. Placeholders use the format ((ViewName.Field)), where ViewName is the name of the View (DAC) in the Acumatica Graph and Field is the DAC field whose value we need to use.
Here is our final base notification template using mjml:
<mjml> <mj-body background-color="#023″ font-size="13px"> <mj-section> <mj-column> <mj-image width="200px" src="http://f.interastar.com/interastar_dark.png"></mj-image> </mj-column> </mj-section> <mj-section background-color="#eee" text-align="center" border-right="solid #ccc 20px"> <mj-column> <mj-text font-size="24px" font-family="Helvetica">Dear ((Billing_Contact.Salutation)).</mj-text> <mj-spacer height="20px" /> <mj-text font-size="16px" font-family="Helvetica">This is an automatic email to notify you that you have a new Sales Quote available on your account.</mj-text> <mj-text font-size="16px" font-family="Helvetica">You will find a copy of Quote <b>#((OrderNbr))</b> attached to this email.</mj-text> <mj-text font-size="16px" font-family="Helvetica">If you have any questions, please don’t hesitate to contact us at ((DefaultCompanyContact.EMail)).</mj-text> <mj-spacer height="20px" /> <mj-text font-size="16px" font-family="Helvetica" font-style="italic">Thank you for choosing ((DefaultCompanyContact.FullName)).</mj-text> </mj-column> </mj-section> <mj-section text-align="center"> <mj-column> <mj-text color="#eee" font-size="14px" line-height="20px" font-family="Helvetica" align="center"><b>*interastar</b><br/>Av. México 700, int. 106, La Magdalena Contreras, CDMX, 10200 MX<br/>(55) 6718-0023</mj-text> </mj-column> </mj-section> <mj-section background-color="#0074b5″ text-align="center" full-width="full-width"> <mj-column> <mj-text font-size="14px" font-family="Helvetica" line-height="20px" color="#fff"> This is an automatic message sent from our 100% cloud platform. If you are looking to transform your business by automating processes while gaining insight and control ask us about Acumatica.</mj-text> </mj-column> </mj-section> </mj-body> </mjml>
Once you are happy with the result, you can save the generated HTML or copy it to memory.
Finally, just paste it inside the HTML view of the template editor.
Wrapping It Up
Acumatica has powerful features that allow its users to automate processes and notifications, but sometimes it makes sense to leverage some external tools to make our lives as developers easier. Often the simple solution is the best or correct solution – lex parsimoniae “law of parsimony.” Also, more commonly known as Occam’s Razor.
By building better and more attractive email templates, we can edit and upgrade the design of all notifications available in Acumatica to give a better experience to your users and customers.