Why doesn't a field marked "Business Required" throw an error when when passed a null value via the webservices?

StackOverflow https://stackoverflow.com/questions/15404343

Question

In MS Dynamics CRM 2011 when a field on an entity is marked as "Business Required", I can create an entity via the webservice SDK without having to provide a value. I've read that this is widely known (and for some reason acceptable), yet I can't see it in any MS documentation. Apparently, business required fields will also accept null values for access via plugins, data imports and workflows.

  • What is the reason behind this? Any reference to MS documentation would be appreciated.

  • If your answer is to the first question is to allow flexibility, then why are other constraints such as field length constraints on "Single Line of Text" adhered to when the Business Required constraint isn't?

Was it helpful?

Solution

A 'requried' field is a concept that only applies on the clientside (e.g. on the form). As you are creating the entity via the SDK (or plugin, or workflow) the clientside scripts are not invoked and so the required status of the field is not checked.

So it isn't flexibility as much as it is not possible to do.

Other constraints, such as field length, as concepts enforced at the DB level. Hence these will be invoked via SDK, plugin etc.

If you wanted to enforce the required fields it is fairly straightforward - add a pre create plugin. Check for values in desired values. If not found, throw an exception.

Licensed under: CC-BY-SA with attribution
Not affiliated with StackOverflow
scroll top