This blog post is inspired by this sharp, jagged piece of metal.
I see this leg cutting, pant ripping piece of metal every morning when I walk into work and think to myself that I should report it. But by time I get to my office it’s out of sight and out of mind and no report is ever made. If there was a more timely and convenient way of reporting the safety issue, I’m sure it would be fixed by now.
In this blog series I’m going to use two of my favorite tools, SharePoint and Power Automate to make a Safety Issue Reporting and Tracking solution.
Let’s start by creating a SharePoint List to store the data associated with the Flow. My list is called “Safety Issue” and will have the following 3 columns:
- “Picture” a Picture column type.
- “Date Logged” a Date column type.
- “Logged By” a Person column type.
Tip: Don’t use spaces in list names on creation. Spaces are converted to “%20”.
It’s better, for example, to create our list as “SafetyIssue” and then rename it later as “Safety Issue”. Once created, the internal list name will remain as “SafetyIssue”.
Tip: Use the “modern” list experience to add columns whenever possible. It will not replace spaces in column names with “_x0020_”. In “modern”, the internal name for “Date Logged” is “DateLogged”.
In “classic””, the internal name for “Date Logged” is “Date_x0020_Logged”.
I set the “Title” column to not required by:
- Clicking “Site settings” > “List settings” > “Title” > “Require that this column contains information:” = “No”.
Now we will create a Flow from within the “Safety Issue” list by:
- Clicking “Flow” > “See your flows”
Create a new “Instant – from blank” Flow by:
- Clicking “New” > “Instant – from blank”.
- Within the “Manually trigger a flow” trigger “Add an input” for “File Content”.
- Add a SharePoint “Create item” action and then:
- Set it to your site and list name.
- Set the “Date Logged” column to “Date” from the “Manually trigger flow” trigger.
- Set the “Logged by claims” to “Username” from the “Manually trigger flow” trigger.
- Add a SharePoint “Add attachment” action.
- Set it to your site and list name.
- Set the “Id” to the “ID” column from the previous “Create item” action.
- Set the “File Name” to “Timestamp” from the “Manually trigger flow” trigger plus “.png”. This is a hack for now and in my next blog post I will outline the steps to use JSON to parse out the file name.
- Set “File content” to “File Content” from the “Manually trigger flow” trigger.
- Add a SharePoint “Send an HTTP request to SharePoint” action
- Set it to your site.
- Set the “Method” to “Post”.
- Set the “Uri” to “_api/web/lists/GetByTitle(‘Safety Issue‘)/items(ID).
- Safety Issue is the external name of the list, note the space!
- ID is from the “Create item” action!
- Set the “Headers” to (using text mode):
- Set the “Body” to:
- Timestamp is “Timestamp” from the “Manually trigger flow” trigger.
- AbsoluteUri is “AbsoluteUri” from the “Add attachment” action.
- Important there are single quotes around ‘Timestamp.png’ and ‘AbsoluteUri‘.
My completed Flow looks like this:
Now we can test using the Power Automate mobile app:
- Click “Buttons”.
- Click your Flow, i.e. “Log safety issue – Part 1”.
- Click “File Content” and then “Camera” to take a new photo or “Photo Library” to use an existing photo.
- Click “Done” to start the Flow.
When the Flow is complete a new row is added to the “Safety Issue” list that displays a thumbnail of the safety issue, the date and who logged the issue. It’s not much but it will serve as the foundation for a larger solution.
Our scenario is pretty common, log concerns and have some one address it. We didn’t have to create a fancy app or over invest in development. We are all out of the box, all configuration and almost no code.
In my next blog post we will build on our safety issue solution and add more SharePoint functionality and Power Automate automation.
Thanks for reading.