Set Reportname while sending Email

Which IIQ version are you inquiring about?

8.4 P2

Hi Team

We are using the OOTB “lifecycle event report” to get the users that are terminated previous day and sending it to recipient with the report attached in the email.

We wanted to update the name of the attachment to display something like this. “<Yesterday’s Date>_TerminatedUsers.csv”. Any idea how to do that?

we are using below entries to set the recipients and fileformat. what should be the entry for filename and that should be calculated dynamically?

  <entry key="emailIdentities">

<entry key="emailFileFormat">


Thanks

Divya M

I dont think thats something configurable.

The workable approach is to stop the report from sending the email itself and send it from a rule instead:

  1. Remove emailIdentities from the report, but keep emailFileFormat set to CSV so the CSV file is still generated. Whether the CSV is still persisted without recipients is the first thing to test.
  2. Create a rule that runs the report, picks up the CSV from the result, and emails it under the name you want.
  3. Schedule that rule with a “Run Rule” task in place of the current report schedule or execute the task as required.

Hello Divya.

Lukasz is right. IIQ 8.4p2 has no documented setting to dynamically name report email attachments. emailFileFormat only controls the PDF/CSV format. CSV files are generated and saved during report execution, even without email recipients. So you can reuse your existing Lifecycle Event report.

I would suggest a scheduled Run Rule task:

  1. Remove emailIdentities and replace the existing report schedule with the Run Rule task.
  2. Execute the saved report using TaskManager.runSync(reportName, args), preserving its parameters. Confirm the returned TaskResult completed successfully.
  3. Render its CSV from the result using JasperRenderer and send it with your filename:
ByteArrayOutputStream csv = new ByteArrayOutputStream();
new JasperRenderer(tr.getReport()).renderToCSV(csv, "csv");

String fileName = LocalDate.now().minusDays(1)
    + "_TerminatedUsers.csv";

EmailFileAttachment att = new EmailFileAttachment(
    fileName, EmailFileAttachment.MimeType.MIME_CSV,
    csv.toByteArray()
);

EmailOptions options = new EmailOptions();
options.setTo(recipientEmail);
options.addAttachment(att);
context.sendEmailNotification(emailTemplate, options);

return "Success";

Here, tr is the completed TaskResult. Resolve the recipients and email template in your rule. renderToCSV() is part of the reporting API (sailpoint.reporting.JasperRenderer), so I would confirm the signature against your 8.4p2 Javadocs and test one run before switching schedules.

Also preserve your original recipient workgroups and empty-report behavior. Calculate yesterday in your reporting timezone, or use the report’s date range for reruns. This should meet your requirement without rebuilding the report.