Use the iAuditor integration with MS Flow to automatically start or pre-populate an inspection with information from a SharePoint list. A SharePoint list can be a great and powerful way of collectively storing data in a central location. A SharePoint List can cater for a range of different data types across a number of different use cases such as asset management, contact lists, issue tracking and many more.
For our setup, we’ll be using the “Asset Management” example where data will already be stored/entered within a list. Each time a new asset/piece of equipment is added to your asset list, we’ll want to automatically start and pre-populate an Inspection with key pieces of information (eg, Serial Number, Model etc). Once your SharePoint Item is added, you’ll be able to open iAuditor and commence the Inspection!
- This setup assumes some knowledge about how SharePoint lists work and an understanding of the JSON data model & the iAuditor API. If you need any additional assistance at any point through this guide, please don’t hesitate to contact us.
- You will need to have your iAuditor Template ready to go, see the “prerequisites” section of this guide.
- Create and set up your SharePoint list with the relevant custom Columns/fields; these will likely be the same as your Template fields.
- For a simple setup, this integration should take as little as 30 minutes to implement.
- Start by creating and defining your Template Fields
- Create a new Template using our Template creation guide
- For our setup, we’ll be using “text” fields from the inspection template’s “information” section (title page)
- With our Template created, head into the Microsoft Flow website to begin building our workflow
- As mentioned, in this example we’ll be triggering a new Inspection whenever a new Item is added to a Sharepoint list
Setup using MS Flow
- To begin, start a new blank flow
- Add the “When an item is created” Sharepoint action
- With your “action” created, we’ll want to make sure we can easily identify it.
- Name your Action by clicking the 3 dots in the left-hand corner and select “rename”
- Populate the details of the SharePoint Site & List you’ll be using to automatically start your Inspections
- Now we’ve defined our site/list details, we now need to begin mapping our SharePoint List/Column responses to specific parts of our Inspection
- Add a new “Variable – Initialize Variable” action by searching and selecting the below
- Once added, set the Variable name “Item Data” and set the type to “Object”.
- We also recommend renaming the Variable itself by following the same steps we carried out for the “When an item is created” action
- To populate the “Value” field, we’ll first need to understand the JSON data model.
- Please read through the “Start Inspection” & “Get Inspection” API documentation to gain a deeper understanding
- In our case, we’ll be looking to populate data on our Inspections “Title Page” (header_items). In this example, we’ll be specifically targeting the “Location”, “Prepared By”, “Asset being Inspected”, “Serial Number” and “Client” fields; you’ll find the break down of this detailed below.
- Note: this same process can be used for other areas/sections of the Inspection too.
- With the “Value” field populated with our target fields, we’ll now need to map the corresponding Sharepoint data.
- Click the whitespace next to the “Type of Response data” (as shown above); the “Add Dynamic Content” selector will pop-up for you to pick the relevant data from the Sharepoint List. This is pulled in from our first action – “When an item is created”:
- The same steps will have to be repeated for each field you’re looking to pre-populate within the Inspection.
- Once you’ve completed mapping your responses, we’ll now need to send this data as an HTTP request to create the Inspection.
- Create a new “HTTP – HTTP” Action as below:
- Change the HTTP Method to POST & set the URI as “https://api.safetyculture.io/audits” as detailed within our Start Inspection documentation.
- Within the Header field, we’ll need to input our API token. This will need to be entered as Bearer <Insert API Token> (NB: with whitespace between the word Bearer and the token) as shown below:
- We’ll now need to grab the data we’ve defined within the “Item Data” variable. Click into the “Body” field to expand the “Dynamic Field” content.
- Select the “Item Data” variable to populate the “Body” field.
- Save and activate your Flow and head over to your SharePoint List to create a new Item
- A new entry should appear on your SharePoint List
- Once we’ve entered the necessary data, the Flow will automatically start the Inspection creation process with our pre-populated fields
- We can see the Inspection our Flow has created below