July 2007 - Posts

Microsoft CRM 3.0 Tips and Tricks

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.

Posted by shayf | 1 comment(s)
תגים:,

"Could not find any resources appropriate for the specific culture (or neutral culture) in the given assembly" error

I had ran into this error a few days ago and spent a few hours until I figured out what the problem was. But eventually I did!

The problem
I had built a win form, added a few resources for different languages and tested it out. When trying to load this form, I realized that the InitializeComponents method had failed. The error was "Could not find any resources appropriate for the specific culture (or neutral culture) in the given assembly.".

The way to the solution
After hours of re-building, clearing, deleting, GACing, restarting and other headache-causing actions, I decided to look into the built resources file using the Reflector. I found out that the name of my resource was wrong...

The cause
When building the form, I added before the form's class another class (for my event args). The name of the resource was named after the event args class and not the UI class, resulting in the error mentioned above...

The solution
Moving the event args class below the UI class solved the problem. Why? I really don't know, but I guess that Microsoft assumes that the UI class is the first in the source file and they've just forgotten to tell us about it.

Conclusion
Keep the next structure in mind when developing win-forms:

class UIClass
{
    // ...
}

// All other classes below the UI class!
class MyEventArgs : EventArgs
{
    // ...
}
// ...

Take care,
Shay

Posted by shayf | 1 comment(s)
תגים:, ,