Showing SharePoint Documents Grid on a Form Tab in Dynamics 365 CRM

While adding Tabs, Sections & Fields is fairly straight forward in Dynamics 365 CRM, showing the “Documents” tab which is accessible from Related section isn’t.

So, here’s how to do it when you need to.

Exporting customizations.xml with Form

Here’s what you need to first do in order to setup the Documents folder on the main form –

  1. Assuming “Docs” is the name of the tab you want to place your SharePoint library in. Add any field for reference which is not used on the form elsewhere. In my case, I’m choosing Address 2: Latitude for easy identification.

  2. Then, make sure you add the Form in a solution and export the solution.


    And then export it –


    And choose it to be Unmanaged to avoid any hassles in case you need to continue customizing this table further


  3. Then, extract the solution folder itself and open customizations.xml.
    Now when you extract the same, find the Docs tab and locate the Control you added.

  4. Now, copy the below code and replace it with the <control> which is highlighted in the screenshot above.
    <control id="DocumentSubGrid" classid="{E7A81278-8635-4d9e-8D4D-59480B391C5B}" indicationOfSubgrid="true" uniqueid="{9cd66b5c-8b7a-6433-c5a5-46a7245dd534}">
    <parameters>
    <ViewId>{0016F9F3-41CC-4276-9D11-04308D15858D}</ViewId>
    <IsUserView>false</IsUserView>
    <RelationshipName>Account_SharepointDocument</RelationshipName>
    <TargetEntityType>sharepointdocument</TargetEntityType>
    <AutoExpand>Fixed</AutoExpand>
    <EnableQuickFind>false</EnableQuickFind>
    <EnableViewPicker>true</EnableViewPicker>
    <ViewIds />
    <EnableJumpBar>false</EnableJumpBar>
    <ChartGridMode>Grid</ChartGridMode>
    <VisualizationId />
    <IsUserChart>false</IsUserChart>
    <EnableChartPicker>false</EnableChartPicker>
    <RecordsPerPage>10</RecordsPerPage>
    <HeaderColorCode>#F3F3F3</HeaderColorCode>
    </parameters>
    </control>

    And paste it in the customizations.xml file where you had the control added.
  5. Now, create a new GUID, you can do so online easily.


  6. Replace this GUID to the uniqueid parameter of the DocumentSubGrid control.


  7. Also, make sure the table which you are enabling this Document tab on the main form – has the correct SharePoint Document relationship entered. In this case, I’m keeping Account, so the RelationshipName is as below –



    And it’s as below –

  8. Now, save the file. Rebundle into a new zip file and import the solution again.
  9. When you refresh the Form, you’ll see that the Documents tab is now on the main form.

Thank you!

Leave a Reply