For some reason, you might want to open a location using the file:// protocol in Dynamics CRM.
In our case, we have 100K+ heavy scan files (>2MB/file) on a network share. Of course, I could publish them on an http server or on Sharepoint, but the engineering and sales department using these files need a very ergonomic and reliable access, and the IT department needs to be able to process all the files extremely quickly. Thus, a link that opens a folder directly on windows explorer best suits our needs (and all users are either in our LAN or connected via VPN). On top of that, we have to deal with access security, and our use case is not supported by default with the CRM/Sharepoint integration.
Of course, the first thing that comes to mind is to use the URL type for the field :
But you will soon find out that there is a constraint on the protocols allowed…
Another solution is to embed an iFrame directly in the form. In our case, the results were very poor : we had refresh issues with the scroll, and no navigation (enter into a folder => no way to go back).
Ok, so let’s dive in, and make it work…
If you want to add a nice icon for the link, you can find one easily on : https://www.iconfinder.com/
In case you need to scale it, you can use The Gimp :
Then, add it as a web resource :
Content of the webpage (you might want to do better than that, js in another webres, headers…) :
Using window.parent.Xrm.Page.data.entity.attributes.get(“stsr_documents”).getValue() enables you to access a value in a field. In my case, I used a field “stsr_documents” to store the full path to the documents, so that it remains easy to verify and quick to load (it would be possible to make asynchronous request to the webservice to build the path asynchronously from the js, but this is inefficient and error-prone).
Insert this simple HTML page into the form :
Ok, that’s all : please comment if you have any improvement ideas. Thank you.