Saturday, April 09, 2011

Microsoft Dynamics CRM 2011 JavaScript Development Cheat Sheet

Microsoft Dynamics CRM 2011 has dramatically changed the JavaScript programming experience when compared to CRM4. So I thought a cheat sheet (or a quick reference document) would help myself get familiar with the latest programming interface. You may download it from the following link on my Windows Live SkyDrive. (Also available at Google Site).


On a side note, some of you may have been curious about (or possibly somehow frustrated by) such API level changes made by MSCRM team in CRM v2011. I think the changes are made for good reasons.
  1. The first motivation is really about the industry standard of JavaScript development. In CRM 4, we use crmForm.all.xxx syntax everywhere, which is really convenient. But it is actually against the best practice in JavaScript development, as this technique is not supported by any other browsers. You may think that CRM2011 is only supported by IE at this moment anyway, why would I care about any other browsers. You are right, CRM2011 is not a cross-browser application, but it doesn't mean that is going to be the case forever. I am relatively confident that the next MSCRM will be a cross-browser one. In fact, I had a close look of some CRM 2011 JavaScript code the other day, I was under the impression that CRM team (probably part of the team) might have tried to make MSCRM 2011 a cross-browser one, but they didn't make the cut for some reasons.
  2. The new CRM 2011 library provides a lot more richer API than CRM4. So we shall require less hacking code if we can take full advantage of the new library, which makes our code more compatible with the future versions.
Note that this cheat sheet primarily focused on the development of CRM form scripts. It didn't cover all aspects of CRM client development practice. If you need a more comprehensive reference of CRM 2011 development practice, SDK document (Download Link) is the best resource available.

As a final note, you should quit using crmForm.all.xxx syntax in CRM 2011 if you are still doing so. ;-)

I hope the cheat sheet useful, and it worths a small spot on your cubicle wall(s). ;-)

[Update - Jun 6, 2011] I uploaded a new version with many fixes of the problems caused by copy/paste. I didn't realize the problems until last week, mainly because I don't work with CRM on day-to-day basis. Sorry for the inconvenience.

Add Spell Checker to Microsoft Dynamics CRM Application

In CRM projects, I often hear the complaints about the lack of spell checking feature in CRM application. Most business users tend to believe it's the application's fault for not having such important feature. In fact, spell checking should be something offered by browser. If you have ever tried any other browsers in the market, you may have noticed that most browsers (Chrome, Opera, Firefox, Safari) nowadays are offering spell checking feature out-of-the-box. IE has been pretty much the only exception among those modern browsers in this perspective.

I was previously aware of an IE addon called ieSpell which offers spell checking solution in IE. But it is far from being an ideal solution because it doesn't instantly highlight any wrong spellings, which in my opinion makes it almost useless.

I happened to come across another free IE addon called Speckie this week which I believe provides a much better spell checking solution in IE. So I thought I should share with everyone here.

After you have installed Speckie, you may notice that Speckie doesn't perform spell check for single line textbox field by default. If you want to enable this option, you can go to IE Tools menu, and click "Speckie Options".

Speckie Options

Then you can check "Enable spell check in single line edit fields" option, and click "Apply" button.

Configure Speckie

After you have done so, you should restart your browser in order for the option to take effect.

The following are a few screenshots in action.

  • Speckie spell checking for MSCRM4 textbox field

Spell Check for CRM4 Textbox Field

  • Speckie spell checking for MSCRM4 notes field

Spell Check for CRM4 Notes Field

  • Speckie spell checking for MSCRM4 textbox field

Spell Check for CRM2011 Textbox Field

I have only been using this addon for a couple of days, I cannot endorse the quality and reliability of this addon. But I am so far very happy with it.

Hope this helps.

Thursday, April 07, 2011

Reached 50,000 Page Views!

I happened to have noticed today that my blog has just reached 50,000 page views this week, based on the data from Google Analytics. You may have noticed that I have a Blogger pageview widget which is only counting to about 43,500 views as of today. The reason for the difference is, PageView stats function was not available on Blogger platform in the very beginning. Believe me, I didn't lie to you, the following is the Google Analytics stats information that I took the screenshot about 90 minutes ago. 50000PageViews
Please don't think that I'm trying to show off here. With only 50,000 Page Views in total in one and half years, there is nothing to show off about. IMHO, I am nowhere close to the page views of any Lady Gaga fan blogs, and I don't think that I would ever be able to make this blog as popular as they are any time soon.

About two years ago (Apr 29, 2009 to be exact), I felt a little bored so I started the journey of writing a technical blog. Did I just sound very politic? YES, I suppose that I was a bit. In fact, one of the important reason is, I don't usually keep track of every details in a very organized way, sometimes I can lose track of what I just did a few days ago or probably a few months ago. In China, we have a say, "The palest ink is better than the best memory". So writing a technical blog not only helps challenges myself, but also has helped me keep track of such details. However, there is another important motivation, which should be kept just between you and me, I have been sick of walking into an interview room with a piece of resume in my hand, which doesn't prove anything nowadays. So I thought writing a technical blog would prove that I am capable of doing some little things, that was just the selfish part of myself. However, I didn't realize in the beginning that writing a blog was actually quite a challenge. As you may not appreciate, it did take me quite a lot of personal spare time to keep this blog updated, even though I am well aware that I haven't actually written much so far. I have to admit, my writing was terribly slow and my English was often broken (thanks for bearing with me all the time), and often times I had to revise my blog posts again and again just trying to make them readable. On a side note, I have quite a lot other topics in my mind that I just haven't got the time to write them down, including some pretty cool (only in my own opinion though) ideas that I wanted to implement on MSCRM platform.

My blog has been mostly focused on MSCRM development practice to this date. I might be switching to some other topics in the future, as MSCRM is no longer something that I am working on daily basis. But I will try to write some CRM posts when I can find time.

Thanks to the CRM community for your support all the time, and more importantly your patience while listening to my mumblings.

Sunday, April 03, 2011

MSCRM 4.0 Error: "Record is Unavailable" after CRM Organization Import

I recently ran into an interesting CRM error after I imported a CRM organization. I got the following error when I was trying to navigate to CRM homepage, after the CRM organization was successfully imported.
Record is Unavailable
The requested record was not found or you do not have sufficient permissions to view it. 
CMIS Import Organization Error

The solution was actually quite simple, you just have to reboot your server after you have imported a CRM organization. I got stumbled upon this error at least twice recently, so I thought I should blog it in case that in the case that you happen to run into this error too.

I believe the error happens when you try to refresh your CRM environment using the same CRM organization name in Deployment Manager before and after the import. My situation is, I had a CRM organization name called ABC previously. But I need to refresh this particular environment (UAT) by using a full db backup from another environment (Production). So I have to create a temporary CRM organization in my UAT server's Deployment Manager, and then I can import the production db backup in order to use the same CRM organization name (ABC). My sense is the CRM organization name was not changed during the ABC –> Temp –> ABC import process, CRM Web application was on the assumption that nothing has changed, so it didn't try to refresh all cached CRM application data including CRM organization information, metadata, etc., which pitifully caused this error.

I believe you could also resolve this problem by restarting all CRM related services on the CRM server, including IIS, CRM Asynchronous Service, and possibly Email Router, etc. But rebooting is always the easiest solution to try first when we have problems with our computers, isn't it?

Hope this helps.