Dynamics CRM Documents Grid

Microsoft Dynamics CRM and SharePoint integrate together quite nicely for storing documents in SharePoint to be viewed in CRM.  To access documents for a particular record simply click the carat next to the record and select Documents in the drop down.  Pretty handy, right?  But sometimes customers want documents on the main page of the record instead of having click away from the page.  Unfortunately there is no supported out of the box way to put a sub grid of documents on the record page.  You are able to put a sub grid of document locations, but that’s not much help you say!  I need the actual documents!  Well there is an easy “trick” to do this and it only requires a few lines of javascript along with an iframe.  Wherever you want the documents gird to show up place an iframe on your form.  For this example I created an iframe with the name of IFRAME_Documents.  The add your javascript below to the form:


In the code above we get the form guid and strip out the brackets, we get the object type code, as well as the record guid and strip out those brackets as well.  Then we call an Xrm.Page.getControl function to get the iframe and set it’s source to the url where the documents grid resides.  And now you have your documents grid right there where you can upload and view documents without having to navigate away from the page!

Leave a Reply

Your email address will not be published. Required fields are marked *