Automation and Flow
In Part 3 we created a Customer list and simple PowerApp so our users can easily see and create content for our clients. In this article, the plan is to start making the buttons to create new documents work using Microsoft Flow. We want it so that when the user clicks on the New Welcome Letter button, the document is created and all they need to do is print and post or attach to email.
In Flow we need to determine exactly what it is we are trying to achieve and in what order.
So the process should be:
- Get the Customer Information
- Grab the content type info and template from SharePoint
- Create a New file using the content type template
- Update the document to have all the details from the customer info
- Grab the document link
- Update the customer item to confirm Welcome Letter has been created and insert link
The New Flow
The very first thing we need to do is create a Flow that PowerApps can reference, we can do this by clicking on the Flow button in the PowerApps menu. We need a PowerApps button trigger, we find this in the templates by searching for powerapps
Just like in the process flow listed earlier, we now just build our flow
1 – Get the Customer Information
In order to populate the letter, we need the customer info. Instead of spending lots of time parsing column info from PowerApps, we simply get the ID number of the customer and then get the info directly from SharePoint.
2 – Grab the content type info and template from SharePoint
As Flow cannot directly create a document from content type, we need to grab the content type information, including the contents of the template
3 – Create a New file using the content type template
So now we create the file, This is pretty straightforward, Flow gives us an action to do this
4 – Update the document to have all the details from the customer info
This is where we fill in the document metadata, we just grab the ID of the document from the Create action and then fill in the fields using dynamic content
5 – Grab the document link
We just get the properties for the file in flow, we only need the link, but will grab the whole thing.
6 – Update the customer item to confirm Welcome Letter has been created and insert link
Finally we update the Customer to confirm the welcome letter has been created and update with a link to it.
Back in PowerApps, we now need to update the “Create Welcome” button so that it sets off the flow and when complete, it converts to a tick, that can be clicked on to open the document
This is the end result:
So we are coming up on the end of the user experience part of this blog series. We have created a basic, but very powerful system to automate the creation of certain documents, store them in a managed way and created an App, that can be accessed on Mobile, that makes it easy to get to the data.
In Part 5 we will be setting up some policy and retention rules for the technical aspect of the system.