Send an E-mail with an Inline Report Using an Automation Policy
search cancel

Send an E-mail with an Inline Report Using an Automation Policy

book

Article ID: 179645

calendar_today

Updated On:

Products

IT Management Suite

Issue/Introduction

Question
I need to create an automation policy to send report results in an e-mail, how can I achieve this?

Resolution

Answer

Configure a report with the desired default values for each parameter and set up a new automation policy from a clone of the 'Send automation policy e-mail' automation policy task.

If you need to tailor the exact message format and/or the output you would do well in cloning the 'Send automation policy e-mail' Automation Policy Task found within Actions > Jobs and Tasks > System Jobs and Tasks > Notification Server > Automation Policy Tasks. This task already has some predefined variables that make it easy to use for the described purpose and to add more variables as needed.

The format for the variable that you can populate with data is %!variablename!%. As an example, the variable to use for the report results in the Send automation policy e-mail Automation Policy Task is %!results!%.

 

 

 

A screenshot of the default Send automation policy e-mail task can be seen above, where all the variables available for use are enclosed with a starting %! and ending !%.
On the screenshot, you'll see %!To_Email!%, %!Cc_Email!%, %!Subject!%, %!Message!% and %!Results!% variables. These (and more) will be available when we look at defining the automation policy below.

Now create a new Automation Policy under Manage > Automation Policies. In this example I created and named one “Client Config Request AutoPol”, as seen in the screenshot;

 

 

For the schedule I used a default Daily shared schedule, but you can utilize a custom schedule if needed.

For the Data Source choose “Report” and for the report choose the report you want to e-mail the results of. In this example, the report name is “Last Client Configuration Request Report – N days”.

The Evaluations Rule under Conditions can be set as either “Run for non-empty data”  or “Run for each record”. As this example simply needs to send the full results of a report it is set to “Run for non-empty data”. However, if you wish to send out an e-mail for each resource/record you can utilize the “Run for each record” option. This would potentially create a lot of e-mails, so be careful when using this evaluation rule for e-mail actions.

For the Actions settings, I chose the Automation Policy Task as discussed above “Send automation policy e-mail”. If you have created your own Automation Policy Task you should select this instead.

NOTE; When you’ve set the run job/task action, it is sometimes necessary to save the changes to the automation policy and reload the page/dialog as some of the information stays cached.

Select the “Edit Input Parameter” link and an empty dialog looking like the one below will appear;

 

For this example the following variables were set/used;

Variable (defined in task)

Data Source

Custom Value

TO_EMAIL

Custom

Set to this to the e-mail recipient you need the e-mail to be sent to.

SUBJECT

Report Name

This inserts the Report Name into the subject field variable in the task.

MESSAGE

Message

This inserts your message in the e-mail

RESULTS

Report as HTML

This formats the report results into HTML and is placed in the e-mail

 

The CC_EMAIL variable was not set or utilized, so this can be left at the Select Field value.

The following built-in Data Sources are available to use;

Data Source

Description

_itemguid List

Contains a list of all the resource/item guids of the report results if these are part of the report

Name List

Contains a list of all resource names (the report needs to contain _itemguid as a field)

LastRequest List

(Unknown)

Report Last Run

Returns the date/time when the report was last run

Report Name

Returns the name of the report

Report URL

Returns the URL/link to the report (this requires console access to view the report)

Report GUID

Contains the guid to the report

Report as HTML

Contains the results of the report in HTML format (tables, formatted nicely)

Report as CSV

Contains the results of the report in comma-separated format (unformatted for display)

Report as Text

Contains the results of the report as Text with some whitespace formatting (no tables, semi-formatted)

Number of rows

Returns the number of rows (resources) in the report

Custom

Uses the value in the “Customs Value” input field