Showing posts from February, 2012

The type or namespace name 'Xrm' does not exist in the namespace

When we start learning about server side extension in CRM 2011, we typically start building a console application and try out CRUD operations consuming CRM web services by referencing sample codes from CRM SDK. So, we normally create a console application, reference the required DLLs from the SDK\bin folder and use those CRM namespace in the code file.
When you try to build the solution, you may get the following error if you don't leave all the settings by default since the console project has been created.

The type or namespace name 'Xrm' does not exist in the namespace 'Microsoft' (are you missing an assembly reference?)

All you have to solve this problem is right click the project, select Properties and change the Target Framework from “.NET Framework 4 Client Profile” to “.NET Framework 4”.

Now, you can start coding and carry on your console application.

Preventing Caching of JavaScript files in IIS7

When there are a lot of client side scripting involved in the MS CRM project, I normally load external JavaScript files for faster development. Opening external js code files in Notepad++ is readable and looks so much better than CRM web resource text editor and we can save a few seconds of publishing web resource after every modification of the code. But we need to disable caching for JavaScript files in IIS or else we have to delete temporary internet files in Internet Explorer to load the updated script file after each modification of the code.

In order to prevent caching of JavaScript files in IIS7, the Output Caching setting of the MS CRM site in ISS Manager need to be changed.

We need to add one entry in the Output Caching with the File extension name ".js" and enable both User-mode caching and Kernel-mode caching and choose Using file change notifications radio button for both sections. Then, click Advanced button and enable Headers checkbox and enter "Cache-Cont…

Bypassing Prompt and Refresh the Form

In some scenarios of client site scripting in MS CRM 2011 (mostly in the custom ribbon button actions), we might have to force the form to refresh in order to show the updated values or refresh the Enable/Disable Show/Hide status of the ribbon buttons.
But sometimes, just triggering the window.location.reload cause the prompt and prevent the form from refreshing if the user has changed any of the values on the form before triggering the ribbon button event.

In order to avoid such prompt, we can check the Dirty state of the form and force to save if the user has updated any field. And simply refresh the form if there is no change done.

function ForceRefreshForm() { if(; else window.location.reload(true); }