Stop using VS 2003 and start using VS 2005 for CRM Development

Most of the development for MS CRM v3.0 I do in Visual Studio 2003. This is because callouts needs to be built on .NET Framework v1.1. All the projects built with Visual Studio are .NET Framework v2.0. Since I dont want to switch between several IDE's all the time, I only use VS 2003.

Today is the day that I found a very interesting blog posting of Arash. See this post for information on how to build your callouts in VS 2005. So, read the post, download his MSI and get rid of Visual Studio 2003!



Earlier this week I removed the popups from this page, now I have added a useful functionality. If you know for sure that I wrote an article about something, then just search for the words you remember. The textbox on the right side will only search this blog.

So far about searching the blog. Now something about searching in CRM.

Do you know on which fields of the entity the quick search is searching on? Or have you ever wanted to make the search also search another field, but it didn't work? Then you must have missed this feature: Quick Find View.

If you go to the customization page of the entity you wish to change, then go to "Forms and views". There is a view called "Quick Find Active [entityname]". On this view there is an option to set the search fields. There you can see and change the fields on which the quick find is searching on.

No more popups!

At least, on this blog...

I've been using Nedstat for sitestatistics from the start of this blog. They have been taken-over by I didn't mind that much, but ever since there have been appearing popups on the blog. Now I'm running google analytics on the blog. They give a lot nicer reports and they do that without popups! Have fun with the improved user experience :)

See here a screenshot of the report of last week:

Optimize MS CRM webservice

Currently I'm working on an import program. I have to import thousands and thousands of records. Usually the crm system is quite fast, but with these huge loads, I'm getting quite anoyed by the performance of the MS CRM webservice. It even causes error messages like "The underlying connection was closed: Unable to connect to the remote server.".

Now there are some performance tweaks available. I wanted to write a post about it, but just before I found an article written by Aaron Elder. This is a must-read for people writing code to import bulk data. However, this page has been removed, but the same information is available at Bill's blog: Blog Move: Speed Racer - Call CRM at speeds that would impress even Trixie

Fetch all records

Have you ever tried to write a code which will get you all records from a specific entity? It's harder then you think it is! Everybody who is a bit aware of the CRM SDK thinks it should be a fetch statement like this:

<fetch mapping='logical'><entity name='account'><attribute name='accountid'/></entity>

This would only give you the first 5000 records in the database! It is written down in the SDK with small letters, but it could drive you crazy..

There are two solutions for this issue.
1) Add a registery setting to specify not to implement MaxRowsPerPage
2) Modify the fetch statement and merge several results

Here are the details for each solution
1st solution
Search in the SDK for the word "TurnOffFetchThrottling". You should add this as DWORD registery setting to HKLM\Software\Microsoft\MSCRM. Set the value to 1. You will now not have the 5000 records limit.

2nd solution
Modify your fetch statement to include paging and count numbers. Store all the data in an DataSet and perform that series of code over and over again as long as there is data coming.

Here's the script you should use to get all accountid's (for clarity and the ease of use I have added a function called "FetchDataSet").

private DataSet FetchAllAccountIds(){
int i=1;
bool bFinished = false;
DataSet dsAllData = new DataSet();
while (bFinished == false)
StringBuilder sbFetch = new StringBuilder();
sbFetch.AppendFormat("<fetch mapping='logical' page='{0}' count='5000'>", i);
sbFetch.Append("<entity name='account'>");
sbFetch.Append("<attribute name='accountid'/>");
sbFetch.Append("<attribute name='new_12_accountid'/>");
DataSet dsTempResult = FetchDataSet(sbFetch.ToString());
if (dsTempResult.Tables[0].Rows[0]["morerecords"].ToString() == "0")
bFinished = true;
return dsAllData;

private DataSet FetchDataSet(string fetchXml)
string strResult = service.Fetch(fetchXml);
DataSet ds = new DataSet();
System.IO.StringReader reader = new System.IO.StringReader(strResult);
return ds;

I hope this saves you some time!

Thanks to Andrew Krivosheyenko for the Regedit solution!

Save disabled fields


I was reading a posting of Ben Vollmer about "Doing Math in Microsoft CRM aka Calculated Field". This is an interesting article, but I noticed something in the posting that I did not know yet. There is a possibility to submit fields which are disabled! I have been using calculated fields before, but I always enabled the field when submitting the page.

So what is the solution? The use of the ForceSubmit attribute.
crmForm.all.field.ForceSubmit = true;

See the SDK for more info