During the past 2 months I've been working on a CRM project. I have to admit that, at first, I was a little bit shocked from the unfriendliness of this product, but after a while I got used to it. I say - at war everything goes!
I've formed a few tips and tricks that I found out during my work. I hope they will be at hand to someone out there. Enjoy.
1. Configure the IIS server to write logs
These logs, along with the CRM logs will give you an idea (sometimes...) of what's wrong.
2. Error Codes Translation
Most of the time, the friendly CRM will write you an error code (something like 0x80040217), which at best will leave you staring at the screen and at worst will make you hurt yourself. Before you do that, open the CRM SDK help file and search for "Error codes". There is a page there with all the error codes and a short description of them. Whoohoo!
3. File Encoding
When you add new pages or change existing ones, and you do everything right but it just wouldn't work, make sure that these files are Unicode encoded. Otherwise you'll be facing lots of problems.
4. Using Session and ViewState
Don't. CRM disables these on the web.config. I ended up implementing a ViewState-like mechanism myself.
5. Microsoft CRM Server vs. CheckPoint VPN
A whole day my team was unable to work with our main CRM server. This is because someone had decided that installing CheckPoint VPN software on this server would be a good idea... This ended up blocking the CRM server for some reason. The problem was solved after uninstalling the VPN software. Be careful!
6. Catch SoapException!
When working with the CRM web services, surround it with a try-catch block and catch SoapExceptions. Then use the detail property to get a much better description of your problem!
7. 0x80040217 Error after a Retrieve call
When you run into this one, check that the Guid you passed exists, it probably doesn't.
8. 0x8004022D Error
Set the name, type and value properties and you'll be fine!
9. 0x80040237
SQL Integrity error. Set the OwnerId property before your request and you'll get through.
10. Add keys to the configuration file
Instead of writing a configuration file yourself, you can use the config file the CRM is using, which lies at the secret location of: c:\windows\system32\inetsrv\w3wp.exe.config
11. Identify on web service calls
Sometimes you want to send your request to the CRM web services as a specific user, you can do it simply by setting the CallerIdValue property on the CRM web service class.
That's it.
I hope these tips will save you some time. If so, leave early today and go have some fun with your family and friends!
Shay.