sharepoint-onlinemicrosoft-dynamicspower-automate

Dynamics 365 (CRM) and Sharepoint Integration / Power Automate


This is a pretty specific question. If you are using Dynamics 365 (CRM) you can integrate Sharepoint with it. This gives you the capability of associating a folder in Sharepoint with a data entity. So for example, a CRM Case (incident) record could have documents associated with it.

A user doesn't really need to know the Sharepoint folder path because they can see the documents directly on a case record.

HOWEVER, we have some Power Automate flows that generate emails from Cases, and we need the documents associated with the Case to be attached.

I basically have that working because I reverse-engineered what the path should be. But there are always edge cases where that logic fails to create the correct path. For example, if there are multiple spaces in a row in the case name, the Sharepoint path will condense them down to a single space. It will also trim leading spaces (and probably trailing as well) in the name. There's no list of the rules for how it generates the path. It has been trial and error.

My question is whether there is some API call that Power Automate could use to acquire the 100% correct path in Sharepoint to the documents associated with the CRM record? If so, my Google-Fu has failed me and/or it is undocumented.


Solution

  • You can query a document location record from the related record in dataverse - https://learn.microsoft.com/en-us/power-apps/developer/data-platform/reference/entities/sharepointdocumentlocation and get "Relative Url" from it. In this case I believe you will get a proper folder that is associated to your record.