SharePoint is a fantastic way to store documents and other files related to records in Dynamics 365. For one thing, the pricing for using storage in SharePoint is next to nothing compared to the price for the same amount of storage if purchased as database storage for Dynamics 365. Which is no surprise, considering documents in D365 are stored as attachments on notes or emails.
Dynamics 365 does come with a SharePoint integration system out of the box, and for the most part, it’s great. There are a few things that we have come across that have often been issues for people, namely:
I’ve recently been working with a product called Microsoft Flow. This is a Microsoft product aimed at not only replacing the existing workflow system for Dynamics 365, but providing the means to automate tasks across a myriad of different systems.
To that end, Microsoft has provided a series of built in ‘Connectors’ that allow for connecting to and performing a predefined set of operations for a vast number of common applications.
I’ve set up a sample Flow that aims to resolve a number of the issues that I mentioned above.
When a record of a specified type is created in CRM, the flow simply sends a folder create API request to the SharePoint API to create each of the required folders for the record, and then creates a Document Location for the record in CRM also, completing the cycle and ensuring that the folder structure is consistent with how the OOTB CRM document integration functions.
The method that is used to create the SharePoint folders is this (in this example for the contact entity):
Data variables can be pulled through from other records in the process, such as the ‘Full Name’ of a contact.
Child folders can also be created in much the same manner:
Like this, we can also create child folders for records that are created in CRM. We can then get a folder structure that ends up something like the following:
The complete flow is very simple and looks like this:
Where the last two steps retrieve the parent document location for the target entity (in this case ‘contact’), and then creates a child document location in CRM for that entity.
This is just a trivial example of how flow can be used to automate some SharePoint processes and help to shorten the amount of time you spend on trivial tasks such as creating folders in SharePoint.