A SharePoint list (similar to a database or spreadsheet) 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 “Template Setup” section of this guide.
- Create and setup 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.
We’ll first need to create and define our Template Fields. Create a new Template using our Template creation guide.
For our setup we’ll be using “Single Text” fields on our Title Page:
With our Template created, head into the Microsoft Flow website to begin building our workflow.
Setting up your Flow:
As mentioned, in this example we’ll be triggering a new Inspection whenever a new Item is added to a Sharepoint list. To begin, start a new blank flow and 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’ll 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”. It is also recommend to rename 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 of this should be represented.
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.
To 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 correpsonding 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 a 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 a 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 has been added to our example SharePoint List as shown below:
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: