This guide will take you through the process of using the iAuditor connector available in Microsoft Flow, which, enables you to automatically export audit reports. Further guides are listed at the end of this article that explain how to send the reports via Outlook or even to SharePoint.
Begin by creating a new blank flow and then add the Schedule – Recurrence trigger. We’re going to configure the flow to check for recently modified audits every hour.
Go ahead and set up the trigger so that the Interval is 1 and the Frequency is Hour.
Note: A maximum of 1000 audits can be processed during each interval. You will need to configure a smaller interval if your organisation is completing more than this number of audits hourly.
The next step is to add the Search modified audits action listed under iAuditor.
Note: You’ll be prompted to add your iAuditor API token if you haven’t already set up authentication for the connector within Microsoft Flow. Should this appear, type “Bearer” followed by a whitespace and your API token, into the API Key field. We suggest “iAuditor” for the Connection Name field.
To configure – Search modified audits, set the Sort Order to desc and click the Modified After field. Swap to the Expression tab in the Add dynamic content flyout that appears, scroll down to click addHours and then utcNow. The last step for configuring this action is to type a comma after “utcNow()” and then “-1” so you end up with “addHours(utcNow(), -1)”.
This expression causes the Search modified audits step to only retrieve audits modified within the hour immediately prior to the time of each flow run.
Next, we will add the Export an audit report action, click the Audit ID field and then select Audit ID from the available dynamic content.
At this point, MS Flow will automatically convert your action so that it becomes nested within an Apply to each loop. Here is how it should look now:
Finish by selecting the export format, PDF or Word, your timezone and an export profile to use if needed.
Warning: Export Profiles are not supported for Word exports at this time.
Click … More and choose Add a do until.
Audit reports are not stored within iAuditor’s cloud – only the raw data is. PDF and Word exports are created from raw audit data on the fly. Due to this, MS Flow must keep checking in with the iAuditor API, until export generation completes. We’ll set that up now.
Click Add an action within the Do until block and then select the action; Check the status of an export request submitted earlier.
Enter the Audit ID and Export Task ID from dynamic content into the appropriate fields. You should end up with the following:
We can finally configure the Do until loop so that it holds the flow up until Export Status is SUCCESS. Configure that as follows:
The final action required is Download an audit report which will cause MS Flow to fetch the PDF or Word document from the iAuditor API. Add the action, ensuring it is below the Do until loop and not within it.
With the action added, fill out the fields using dynamic content:
You’re now ready to continue on with one of the following guides: