Modifying Views outside Microsoft CRM

Last week a colleague tried to create a view in Microsoft CRM to show Accounts that were in an Inactive state and had a merged Master contact record. Microsoft CRM doesn’t allow the MasterID field to be queried or returned in Advanced Find nor does it allow it to be changed (by changing the ‘Searchable’ option on the attribute).

The quickest and dirtiest way around it is to modify the view in the table itself. Since all user and system views are simply FetchXml, we’re able to create views that the AF tool won’t let us create.

I used his view as the starting point:

I Searched and found the query in the UserQueryBase table and copied out the FetchXml and LayoutXml columns.

I modified the FetchXml as follows (the additions in bold and italics):

And I modified the LayoutXml as follows (the additions in bold and italics):

I then saved them back to the SQL table and re-ran the query in CRM:

Needless to say, this is an unsupported customisation change to Microsoft CRM- after doing the above, you’ll see the following in Advanced Find: