Schedule Reports to store in Shared Drive

Hi All,

Hope all doing good.

Currently, our Access Governance Team manually generates four out-of-the-box (OOTB) reports before and after scheduled certifications. During the certification period they generate few reports as well. Now we are working on automating this process to reduce manual effort. We are automating this process using - Option: The most common and effective way is to create a custom TaskDefinition of type “Run Rule” or “Execute Workflow” that then programmatically triggers the report generation tasks. We are going to work on this once the automated role addition is completed.

But the problem is we have to store that generated reports into some Shared Drive location. Could anyone please guide on this how can we achieve this in Sailpoint IIQ.

Regards,

Venu

I wasn’t directly involved in the implementation of this use case, but I know loosely how it was done. In our case, it was all done externally to IIQ.

We utilized a Microsoft Power Automate flow that monitored an inbox to search for the specific email subject. when it arrived the attachment was extracted and upload it to a file share.

Could you please check with the people who involved in this and let me know the complete process if possible.

Try following these steps to create a flow in Power Automate: Power Automate - Workflow to monitor email inbox and move certain files (by name) to Sharepoint. - Microsoft Q&A

Yes, you can do this with JasperReports. Since SailPoint IIQ reports are based on Jasper, you can customize the execution so that when a report is generated (PDF, XLS, etc.), the output stream is written directly to your shared drive path. This can be handled in a custom task or workflow, as long as the IIQ server has access/permissions to that location

Thank you for the input. do you have any sample code/snippet. It would be helpful for me.

Here is the sample code ,


  import sailpoint.object.JasperResult;
  import sailpoint.object.PersistedFile;
  import sailpoint.object.FileBucket;
  import sailpoint.api.TaskManager;
  import sailpoint.object.TaskResult;
  import sailpoint.tools.Util;
  import sailpoint.object.QueryOptions;
  import sailpoint.object.Filter;
  import sailpoint.tools.Message;

  import java.text.SimpleDateFormat;
  import java.util.Date;
  import java.util.List;
  import java.util.HashMap;
  import java.io.File;

  String byteString = "";
  int count = 0;
  String fileName;
  String folderPath = "C:/Report Compare";
  TaskManager taskManager = new TaskManager(context);
  TaskResult taskResultObject = taskManager.runSync("Entitlement Detail Report v1", new HashMap());

  public void updateTaskResult(String level, String msg) {
    if (taskResult != null) {
      try {
        if ("Info".equalsIgnoreCase(level)) {
          taskResult.addMessage(new Message(Message.Type.Info, msg, null));
          log.error("TaskResult Updated: " + msg);
        } else if ("Error".equalsIgnoreCase(level)) {
          taskResult.addMessage(new Message(Message.Type.Error, msg, null));
          log.error("TaskResult Error: " + msg);
        }
      } catch (Exception e) {
        log.error("Error updating TaskResult: " + e.getMessage(), e);
      }
    } else {
      log.error("TaskResult is null. Cannot update messages.");
    }
  }

  HashMap fileDetails = new HashMap();

  if (null != taskResultObject) {
    JasperResult jasperResult = taskResultObject.getReport();

    if (null != jasperResult) {
      List fileList = jasperResult.getFiles();

      for (PersistedFile file : fileList) {
        if (file.isCsv()) {
          SimpleDateFormat sdf = new SimpleDateFormat("MMddyyyy-HH-mm-ss");
          Date date = new Date();
          fileName = file.getName().substring(0, file.getName().indexOf(".csv"))
            + "_" + sdf.format(date) + ".csv";

          File directory = new File(folderPath);
          if (!directory.exists()) {
            boolean isCreated = directory.mkdirs();
            if (!isCreated) {
              updateTaskResult("Info", "Failed to create directory: " + folderPath);
              return;
            }
          }

          QueryOptions qo = new QueryOptions();
          Filter filter = Filter.eq("parent", file);
          qo.addFilter(filter);
          qo.addOrdering("fileIndex", true);

          List fileBucketList = context.getObjects(FileBucket.class, qo);
          for (FileBucket fileBucket : fileBucketList) {
            byteString += sailpoint.tools.Util.bytesToString(fileBucket.getData());
            count++;
          }

          String filePath = folderPath + "//" + fileName;
          Util.writeFile(filePath, byteString);

          File createdFile = new File(filePath);
          if (createdFile.exists()) {
            String time = sdf.format(new Date());
            String creationTime = sdf.format(new Date());
            fileDetails.put("filePath", filePath);
            fileDetails.put("fileCreationTime", creationTime);
            fileDetails.put("fileName", fileName);

            updateTaskResult("Info", "File is created in folder \"" + folderPath + "\" at \"" + time + "\" and the file name is \"" + fileName + "\".");
          } else {
            updateTaskResult("Info", "File creation failed.");
          }
        }
      }
    } else {
      updateTaskResult("Info", "No JasperResult found in task result.");
    }
  } else {
    updateTaskResult("Info", "Task result is null.");
  }

  if (!fileDetails.isEmpty()) {
    log.error("Stored File Details:");
    log.error("Path: " + fileDetails.get("filePath"));
    log.error("Creation Time: " + fileDetails.get("fileCreationTime"));
    log.error("File Name: " + fileDetails.get("fileName"));
  } 
  </Source>
</Rule>


what is taskResult in updateTaskResult method?

Can we get IIQ access to shared drive path? is this possible?