views:

103

answers:

2

MSCRM 4.0

When writing plugins, I have assumed that the required fields will always exist either in the Target image or the PreImage image. But recently when coding an external application that consumes the CrmService, I realised that the service will allow a business entity (or dynamic entity) to be created using the 'Create' method, even if the required fields do not exist or contain a value.

Is this the case? Is there a way to force required fields when calling the Update method of the service? Does anyone know why this may not be the case? Can anyone shed some light on the issue? Will I have to manage these required fields myself?

+2  A: 

No, there is no validation. For standard entities you can look for platform required fields - these are required. But generally they're limited to things like the business unit on a report or something - rare cases. If you want business validation you will need to add it into the Pre-Create/Update plugin.

benjynito
+1  A: 

There is no validation. That's why we need to make sure that those properties are filled properly with the valid value.

Proper validation rules need to be enforced at PreCreate event, so that you can throw InvalidPluginExecutionException to notify users that certain mandatory properties are not filled properly.

hadi teo