Stefan Pienaar
I would love to change the world, but they won't give me the source code

Getting meaningful error messages from CRM’s Web Service

April 16, 2009 22:43 by stefanpienaar

When I first started working with CRM’s web service, I was really frustrated by the lack of a detailed error message when something went wrong, turns out there is an easy way to always get a descriptive error.

I used to only catch a generic Exception and most of the time the only error message you’ll get from that is “Server was unable to process request”. In the example below I’m creating a phone call activity and assigning it to a system user.

image_thumb1

However, when you catch a SoapException (found in the System.Web.Services.Protocols namespace) instead, you can view the SoapException’s Detail Property which has an InnerXml property.

image_thumb4

Ahhhhh, I was using a Guid for a system user which doesn’t exists… *facepalm*


Categories: Microsoft CRM 4
Actions: E-mail | Permalink | Comments (0)