It can be important for managers or supervisors to review an inspection under a certain score immediately, rather than rely on users to send these reports manually. Using Power Automate, an integration can be set up to automate the process and notify the right people, at the right time. This article outlines the steps to automatically send emails when an inspection score falls below a certain threshold using Power Automate.
- iAuditor Premium subscription
- iAuditor API Token
- Microsoft Office 365 user account
- Access to the Premium version of Power Automate (previously Microsoft Flow)
- Microsoft Outlook email account
Steps to setup your Flow
In this setup we will schedule the flow to run every hour and search for completed inspections (the recurrence can be changed), followed by a filter that only proceeds if the inspection score falls below a certain threshold. At that threshold, the final step in the Flow sends emails using contents from the inspection dynamically.
- Navigate to Power Automate and login to your Office 365 account
- Click "Create" on the left hand side and select "Scheduled flow"
- (optional) Name your Flow to help identify the automation
- Configure the following:
Starting: The date and time you want your first flow to start - set this accordingly
Repeat every: The interval you want the flow to run on - set this as "1 Hour"
- Click "Create" notice, the first step is already set
- Proceed with "+ New step"
- Search and select the “Get past time” action
- Configure it to match the “Recurrence” of “Interval” = 1 and “Frequency” = Hour
- Proceed with "+ New step"
- Search and select the "Search modified audits - iAuditor" action
- Set the "Modified after" field to use Past time from the available dynamic content
- If you wish to only search for inspections from a specific template, enter "Filter by Template" with the template's template_id
You can locate template_id by exporting an inspection to CSV and finding the relevant column
If this is your first time using iAuditor on Power Automate, you will be prompted to authenticate the connection.
- When the authentication prompt appears, enter “iAuditor” as your “Connection Name”
- Within the “API Key” field, type “Bearer” followed by a whitespace, then your API token
- Your connection setting should be as below. In the example shown our API token is dnz2xwy...
- Search and select the "Get a specific audit - iAuditor" action
- Click the Audit ID field and select "Audits Audit ID" from the Dynamic Content on the right
- This will automatically nest your action within an "Apply to each" loop
- Click the "Get a specific audit (Preview)" step and check that the system selected the "Audits Audit ID" from the previous step
- Now "Add an action" within the Apply to each loop
- Search and select the "Condition" action
Two paths will be created below: "If yes", and "If no"
- Click on the “Choose a value” field and select "Score Percentage from the Dynamic content list
- Configure the filter from "is equal to" to "is less than"
- Input the score threshold you wish to set in the text field
- Now "Add an action" within the "If yes" path
- Search and select the "Send an email (V2)" action
- Your office 365 account should be automatically selected as the email account
If you wish to use another Outlook email account, click the 3 dots on the top right corner of the step and select "+ Add a new connection"
- Customize the email accordingly – items from the inspection can be selected from the Dynamic content list for the email body
- “Save” on the top right corner to turn on your Flow
- Make sure the Flow is turned on, then conduct a new inspection
If you have filtered for a template, use that template for this inspection
- Complete the inspection
- Select "Test" from the top right corner of the Flow edit page
- Choose "I'll perform the trigger action" and "Test"
- Confirm the test by clicking "Run flow"
- The recipients should receive an email with the customized body if the test inspection scored below the threshold