A common, real world, business process that needs automation is the creation, signing and monitoring of contracts. As the whole process is usually a team effort it seems appropriate to develop the tools to be surfaced via Microsoft Teams.
So, lets define the user requirement / use case and walk through the tools needed and how to implement them in your office 365 environment
Use Case: Create a system that can help to quickly generate template driven contract style documents that can be easily prepared for signature. On receipt of scanned contract by return add to a monitored list of contracts for renewal monitoring.
Part 1 – SharePoint Online + Flow
So, we have several types of contract we can request but for this blog we’ll work with just two – it’s either a Statement of Work (SOW) or a non-disclosure Agreement (NDA)
In the SharePoint list (which for simplicity we added to the Microsoft Teams created SharePoint site) we get the user to add details such as Company name, Registration number, document reference and any items that need to be populated on the document itself. In addition, we add a yes/no flag to indicate that it is ready to create a document (to allow users to source any missing data but not loose changes)
The Flow then works on the on-change event and looks for the flag to be set to yes;

We have added a type column where the user can pick SOW or NDA, so the next step is to pick up the SharePoint Online column data and test which one we have;

Once we have determined the file type, we need to populate the Word template. Now you can pick as many fields as you like to populate so long as you have these mapped inside your template document;

To map the fields simply open the word document in the Word Application, if you have not done so already turn on the developers tab by;
On the File tab, go to Options > Customize Ribbon.
Under Customize the Ribbon and under Main Tabs, select the Developer check box.
Once open, from the Controls area add in the text or date fields you want on the document

Save your file in an accessible location – for us it’s in the SharePoint site that was created by the Microsoft Team in a library so not easily found (so we don’t get anyone changing it who does not know how to)
Then add into you Flow a “Populate a Microsoft Word template” and complete the first three boxes to point to the template file;

On completion of the third box the list of fields you can assign you values to dynamically appear, pulled from the document properties as shown in the partial snippet.

Go through assigning your dynamic values from your list item. then create your file using the SharePoint Create File action in a target document library as show;

This will then create your document pre-populated with your list data and this completes Step 1
Now, just to complete this step let me explain why our document didn’t go directly to a signature ready pdf. The next step of the process for this use case is to complete some further detail in the document, not as necessary for an NDA but for a Statement of Work you need to add lots of detail about the work being undertaken.
Once that detail is complete the user can then save as pdf and send off for signature.
Microsoft Teams – This solution is designed to work inside Microsoft Teams. We deploy inside a channel called “Contracts” and use the tabs for access to the SharePoint Lists for data entry, document editing once created, upload once signed and for the PowerApp to read in the signed document as shown below


Part 2 – SharePoint Online + PowerApps
Part two of the requirement can be used entirely independently of part 1 and is featured on another blog post I have already created here – https://power-full.blog/2019/07/03/powerapps-ai-builder-demo-form-processing-with-pdfs/

This PowerApp uses the PowerApps AI Builder to recognise the field entries from your scanned and uploaded pdf and allows you to change them before storing the final information of the signed contract. As we all know contracts don’t always end up signed with the same details that they started, and a lot of documents created will never be signed. So, this solution works completely separately to the first but again is deployed in the same Microsoft Teams channel.
The SharePoint list where the data is stored then has a Flow that announces back to the team via email – shown above in Teams image when an expiry is due and we also have this creating an adaptive card for a better layout – some people prefer emails to their own mailboxes for this but we wanted to keep all the communications within Microsoft Teams for this solution.
This is the end of the solution – if you’d like to see a live demo of this please let me know as I’m recording it as a video for my upcoming launch of my own YouTube channel.