search cancel

Send CSV results as attachment in the Automation Policy e-mail

book

Article ID: 162988

calendar_today

Updated On:

Products

IT Management Suite

Issue/Introduction

When using the "Results as CSV" option in an Automation Policy, there is no 'new line' after each row. The data that is emailed is in one row. Can the results be copied and paste into Excel or a CSV file?

Environment

8.x

Resolution

This information was originally provided under the following Symantec Connect article (also under KB 219364): How to send attachments in the Automation Policy e-mail?

Using this information, the following should show you how to accomplish sending CSV results as:

  • An attachment
  • In the email body with the proper new lines

As an attachment

  1. Go to Manage > Jobs and Tasks, clone the task Send automation policy e-mail
  2. Rename your task if necessary then paste the following text into the content area with the following:

<!-- SMP:A;Results.csv -->

%!Results!%
<!-- SMP:B -->

<HTML>
<HEAD>
  <style type="text/css">
    body { font-size:9pt; font-family: verdana, sans-serif; }
    .titleBar { background-color:#ffdf5a; border: solid 1px #666; padding:0; 
margin-bottom:1em; }
    .padding1 { padding:3px; }
    .padding2 { padding:2px; }
    .logo { font-family: 'times new roman', serif; float:right; font-
weight:bold; font-size:13pt; }
    .title { color:#666; font-size:16pt; }
    .header { border-top: solid 2px #8ca5c6; padding:0; font-family: verdana, 
sans-serif; font-size:8pt; font-weight:bold; background-color:#c0d3ed; }
    sub { font-family: verdana, sans-serif; font-size:5pt; }
  </style>
</HEAD>
<BODY>
  <div class="titleBar">
    <div class="padding1">
      <div class="logo">Symantec<sub>TM</sub></div>
      <div class="title">Automation Policy Message</div>
    </div>
  </div>
  <p>
    %!Message!%
  </p>

</BODY>
</HTML>

As you can see we are adding a MIME type into the body:

<!-- SMP:A;Results.csv -->

%!Results!%
<!-- SMP:B -->

It will attach the results as a file, in this case as a csv file.

  1. then go to ManageAutomation Policies, create a new policy and rename it
  2. Change the following parameter:
    • Data Source
      • Data source: report
      • Report: select the report you need , eg. Windows Compliance by Bulletin
        • If necessary, edit input parameters, such as bulletin release date range or vendors/os
    • Conditions
      • Evaluation Rule: Run for non-empty data
    • Actions
      • Run job/tasks: change to the task created in step 1
      • Edit input parameter
        • Populate recipient and Subject info
        • Change the Results dropdown menu to Results as CSV

  1. Test run the automation policy to verify
  2. If correct, turn on the Policy

In the email body with the proper new line

  1. Modify "Send automation policy e-mail" task or similar ones to add the results without HTML formatting.
    1. For example - clone the "Send automation policy e-mail" task.
    2. Replace the message content

with just:

%!Message!%
%!Results!%

  1. Then select this new task in the automation policy and set up the parameters as you did before. And you'll receive correct results with the proper spacing that you can copy and paste in excel.

Attachments