Enable the Report Contents [20 Rows] in the SEARCH SUBSCRIPTION REPORT OOTB Email Template

Problem

We enabled the Search Subscription reports where couple of reports were getting generated and scheduled for run once everyday. The Customer wanted the contents of the report as well in the Email Body apart from soft links which SailPoint OOTB Email Template already provides.

Diagnosis

As per the SailPoint documentations, we found that OOTB Email Template for Subscription Report DISABLES the email contents to be shared through Email Body due to security concerns and also, it only prints 20rows per report. So, lets say if your report has 25 rows, then, only 20 will be displayed in the Email Body and the whole report has to be accessed using Soft Links only

Solution

  1. Changes the Email Template named as :: “Subscription Notification” by going to Admin → Global → Email Templates.

  1. Take the backup of existing template velocity code.
  2. Cope Past the below contents, save the template.
<p>You're receiving this email because you're subscribed to the search query: <span style="font-weight: bold;">${searchName}</span>.</p>

<p>The query for this subscription is:</p>
<table style="margin-top: 3px; margin-left: 15px; background-color: #ffffff; border: 3px double #bbbbbb; border-spacing: 0px;">
  <tbody>
    <tr>
      <td style="background-color: #e8e8e8; padding: 5px;">${searchQuery}</td>
    </tr>
  </tbody>
</table>

#if (!${searchResults.isEmpty()})
<p>
  Here's a summary of the results for this query:<br><br>
  #set ($count = 1)
  #foreach ($documentType in ${searchResults.keySet()})
    <span style="margin-left: 15px; font-weight: bold;">
      ${searchResults.get($documentType).get("count")}&nbsp;${searchResults.get($documentType).get("noun")}
    </span>
    #if ($count < ${searchResults.keySet().size()})<br><span style="font-size: 4px;">&nbsp;</span><br>#end
    #set ($count = ${count} + 1)
  #end
</p>
#else
<p>${searchName} is returning no results at this time.</p>
#end

<p>View results:<br><br>
  <span style="margin-left: 15px;">Click <a href="${identityNowUrl}/ui/search/?savedSearchId=${savedSearchId}">here</a> to run this query in ${PRODUCT_NAME}.</span><br>
  <span style="font-size: 4px;">&nbsp;</span><br>
  <span style="margin-left: 15px;">Click <a href="${identityNowUrl}/ui/d/reports/${taskResultId}/?name=${fileNameEncoded}&amp;savedSearchId=${savedSearchId}">here</a> to download the generated report.</span><br>
  <span style="font-size: 8px;">&nbsp;</span>
</p>

#if (!${searchResults.isEmpty()})
  #foreach ($documentType in ${searchResults.keySet()})
    <p style="margin-bottom: 20px;">
      ${documentType} Results Preview
      #if (${searchResults.get($documentType).get("preview").size()} > 20)
        (displaying first 20 results)
      #end:
    </p>
    <table style="margin-top: 3px; background-color: #ffffff; border: 1px solid #bbbbbb; border-collapse: collapse; color: #333333;">
      #set ($isHeader = true)
      #foreach ($previewRow in ${searchResults.get($documentType).get("preview")})
        <tbody>
          <tr>
            #foreach ($previewCell in ${previewRow})
              #if ($isHeader)
                <th style="border: 1px solid #bbbbbb; padding: 5px; background-color: #dddddd; font-weight: bold;">${previewCell}</th>
              #else
                <td style="border: 1px solid #bbbbbb; padding: 5px;">${previewCell}</td>
              #end
            #end
          </tr>
          #set ($isHeader = false)
        </tbody>
      #end
    </table>
  #end
#end

<p>
  If you have any questions about this email, please contact the subscription owner
  <a href="mailto:${ownerEmail}?subject=Re: [${PRODUCT_NAME}] Subscription: ${searchNameEncoded}">${ownerName}</a>.
</p>

<p>
  Thanks,<br><br>
  The ${PRODUCT_NAME} Team
</p>

<p>
  <a href="${identityNowUrl}/ui/d/unsubscribe/${scheduleId}">Unsubscribe</a>
</p>

The below is the content which will provide you summary table in email body.

  1. Test.
1 Like