I blogged about displaying SharePoint Documents related to Parent Records on a Child Record in Dynamics 365 earlier this week, and today I’m dipping my toes into the world of vlogging for those who’d prefer a more visual overview of the functionality I described
Recently my friend Sara Lagerquist asked if there was a way to show the documents stored on SharePoint for a parent entity record on a child entity record (e.g. seeing Documents related to an Account on an Opportunity) without having to copy the documents between SharePoint sites.
This sounded like an interesting challenge so I decided to see if I could find a solution.
In my organisation, we have a custom entity called Engagement which is a child of the Account entity that we use as part of our project management processes. It’s not uncommon whilst on an Engagement to want to refer to a contract or other reference file which may be contained on the SharePoint site related to the Account, so finding it can involve a lot of clicking around between records, or navigating back and forth between D365 and SharePoint. The relationship between the entities and the SharePoint sites can be seen below:
In practice, this means that if I was on an Engagement record and there was a reference document in Document Library 1 on the Client Site that I wished to view, I’d have to navigate back to the Account, then look for the related Documents on the Account to see the information I want, then go back to the Engagement. It would be much simpler if I was able just to view this directly from the Engagement.
The solution to this situation was to create a simple Flow:
This Flow is made up of two actions:
- Find all related Document Locations for the Parent record
- For each Document Location, create a copy and Set Regarding to the Child Record
The key thing to note when creating the new Document Locations is that you must ensure you copy the Relative URL, Parent Site or Location and Parent Site or Location Type from the Document Location you’re copying, and then set the Regarding Type to the entity type of the Child Entity, and set the Regarding to the record you’ve triggered the Flow from.
Once you’ve completed these steps, you’re good to go
As you can see from the screenshot below, on my Account record I have a Document Location called Reference Documents that has two files in it
On my Engagement record I have 3 documents in the Document Locations related to the Engagement record. If I want to access the Client Contract file from the Account I need to navigate to the Account record.
After I run my Flow I now have a new Document Location on the Engagement record and I can see the documents from the parent Account record.
Note that the Path for the Engagement related documents is different from the Path for the Account related documents; the Document Location in D365 acts as a signpost to the actual location on SharePoint. This means that the Document only exists in one location, so any changes to it from either the Account or the Engagement will be visible from both records.
This is a simple way to improve the experience for your Users, allowing them to find the information they need quickly and easily, and reducing the amount they might need to click around your system. Let me know in the comments if you think this will be useful for you!