When creating a CRM view you can define the column width of each column (in pixels). The column properties editor gives you a few (limited) set of possibilities.

2017-02-03-09_21_35-view_-active-questions-microsoft-dynamics-crm
The column properties editor

You can find yourself in the situation where the pre-defined column widths don’t suffice. Maybe you want to make the column width bigger than 300px? Now, can we? And can we do this in a supported way? Yes, we can!

Internally, those CRM views are stored in a the SavedQuery (or UserQuery) entity. Those entities contain a LayoutXML and a FetchXML property. It’s the LayoutXML where the layout of the view is configured. You could try to modify this XML manually (taking into account the schema, see msdn), but there is  a much easier way.

When you have the column properties window open, you have to open the browser developer tools (F12). In the developer tools window you have to click the “Select an element in the page to inspect it” button. After, you should click the radio button that is currently selected. 300px in my example.

2017-02-03-09_45_08-developer-tools-http___bemeche1crm01_ofscrmwealth_tools_vieweditor_viewmanager
Click inspect element (1), and click the selected radio button (2)
2017-02-03-09_48_23-view_-active-questions-microsoft-dynamics-crm
Select the selected radio button

After you have selected the radio button, the HTML element is highlighted in the elements tab in the developer tools window. As you can see there is a “value” property on the element. For the 300px radio button for example, this value equals 300. The only thing you have to do, is to change this value to the value you desire.

2017-02-03-09_49_41-developer-tools-http___bemeche1crm01_ofscrmwealth_tools_vieweditor_viewmanager
The radio button element is selected in the developer tools window

For example if I change the value from 300 to 400 (in the developer tools window) and after you click “OK” (on the column properties window), the view will change the width of the column to the value you have supplied.

After you re-open the column properties window, you will notice that there is no column radio button selected anymore. This is because you have saved a custom column width and the CRM UI cannot map it to a radio button. This is perfectly fine and nothing to worry about. If you re-select one of the radio buttons, it will re-use that width.

2017-02-03-10_23_30-questions-active-questions-microsoft-dynamics-crm
Because we used a custom width, no radio button will be selected when re-opening the column properties window

I prefer this method over the manual altering of the LayoutXML. If you want to customize your view even further by, for example, adding columns that are not in the list then you have to modify the XML. The easiest way to edit the Layout XML is by editing the customizations.xml or by using the “View Designer” tool from XrmToolbox.

2 thoughts on “Custom column width in a CRM view”

Leave a Reply