Automatically export inspections with MS Flow
This guide will take you through the process of using the iAuditor connector available in Microsoft Flow, which, enables you to automatically export inspection reports. Further guides are listed at the end of this article that explains how to send the reports via Outlook or even to SharePoint.
- Premium iAuditor User Account
- iAuditor API Token
- Office 365 User Account
- Access to the Premium version of Microsoft Flow
Begin by creating a new blank flow and then add the Schedule – Recurrence trigger. We’re going to configure the flow to check your iAuditor data for modified inspections each hour.
Go ahead and set up the trigger so that the Interval is 1 and the Frequency is Hour.
The Get past time action is also needed for this. Add it to your flow and configure it to match the settings for the trigger.
A maximum of 1000 inspections can be processed during each interval. You will need to configure a smaller interval if your organization is completing more than this number of inspections hourly.
The next step is to add the Search modified audits action listed under iAuditor and set the Modified after field to use Past time from the available dynamic content.
When the authentication prompt appears, enter “iAuditor” as your “Connection Name”.
Within the “API Key” field, type “Bearer” followed by a whitespace and your API token. Your connection settings should be as below:
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.
Click … More and choose Add a do until.
Inspection reports are not stored within iAuditor’s cloud-only the raw data is. PDF and Word exports are created from raw inspection 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 to 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: