Dynamically assigning templates to outgoing email
The Email Engine gives developers more control over the content and format of email sent from AR System. Content creation and formatting (including the use of graphics) are accomplished by designing and storing the templates and images in the AR System Email Templates form. The Email Engine then uses templates stored in this form to format outgoing email.
The Notify filter and escalation action integrates with Email Engine templates, allowing dynamic template assignment. With templates stored as "data in a form," you can see them using workflow. The Templates tab of the Notify action allows you to assign header, content, and footer templates. As demonstrated in , you can hard-code these templates by using the template name. You could also dynamically assign templates through workflow.
Suppose that the XYZ software company uses four HTML header templates (already stored in the AR System Email Templates form) to provide a banner at the top of outgoing emails that are sent when records are assigned. The templates are designed so that technicians can quickly tell if an incident's impact is urgent, high, medium, or low.
The header template to use for an incident based on the impact
You can create a data-driven approach to dynamically assign the correct template for the appropriate impact.
The following procedure assumes your Email Engine is properly configured, your users have their own email mailboxes set up, and you have created and stored your templates. This procedure requires that you first create the following BMC Remedy AR System objects:
- Two regular forms (XYZ Templates and XYZ Incidents)
- Selection field on templates form
- Hidden character field on the incident form
- Filter using Set Fields and Notify actions
- Search menu for template form (optional)
To dynamically assign templates to outgoing email
- Create a regular form (for example, XYZ Templates).
- Add a selection field to the XYZ Templates form.
This field should use the same attributes you plan to use to determine template assignment. In this example, the Impact selection field attributes are used: Low, Medium, High, and Urgent. - Create a character field (for example, Template Name) to store the value of the template to be used.
- (Optional) Attach a character field search menu that queries the AR System Email Templates form as a further enhancement.
- In a browser, open the XYZ Templates form in New mode.
- Create the records for each Impact type, selecting the proper value for the Template Name field.
Four records are created — one for each of the impact values. - Create a regular form (for example, XYZ Incidents).
- Add a hidden character field (for example, Header Template) to the XYZ Incident form (the following figure).
This field stores the name of the header template to be used with each incident when it is created or modified.
A form with hidden fields
(Click the image to expand it.)
- Create a filter to set the value for the Header Template field on the XYZ Incident form.
- In the Basic tab, select XYZ_Incidents as the form.
- Select Submit and Modify as the execute conditions.
- Enter 'TR.Impact' != $NULL$ as the Run If qualification.
Here you want the filter to execute on Submit or Modify whenever the value of the Impact field changes (that is, when the filter detects there is a new transaction value in the Impact field).
- In the If Action tab, create a Set Fields action with the following parameters:
- Read the value for the field from the XYZ_Templates form.
- Enter 'Impact' = $Impact$ as the Set Fields Run If qualification.
- Select Header Template as the field name and $Template Name$ as its value.
With this workflow, the name of the proper template, based on its impact, is stored with each incident. Here you define the filter to query the XYZ Templates form created earlier where 'Impact' = $Impact$, and you set the value of the Header Template field on the XYZ Incident form from the value of the template name field on the XYZ Templates form.
- On the filter, create a Notify action.
- Place the variable $Header Template$ in the Header field.
- Enter other parameters as needed, for example, $Submitter$ as the user name, relevant text (including request ID of the ticket), and so on.
The result of this filter is data-driven automatic template assignment workflow.
- In the XYZ Incidents form, create a new ticket (for example, for Joe User) and assign it an urgent value.
The filter workflow executes and creates a new ticket. This workflow will also create an email notification with the proper header template dynamically assigned based on its impact level.
When Joe User opens his email client, he receives the following email:
An email notification with the Urgent header template
(Click the image to expand it.)
You could enhance this with a content template used specially for urgent tickets.