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.

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.

Click inspect element (1), and click the selected radio button (2)
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.

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.

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.

One thought on “Custom column width in a CRM view”

Leave a Reply