Anyone can set requirement level for required field to any attributes in CRM 4.
The following instruction will help to set required field validator.
1. From the Web Application -> to to Settings -> Customization -> Customize Entities.
2. Open the entity where the attribute belongs.
3. Go to Attributes and open the attribute which requirement level need to change.
4. In requirement level change it to the option that represents Business Required.
5. Save and close, and publish changes of that particular entity. Now this particular attribute set as required field for that entity in form. If anyone don’t want to set any required field for attribute ,then change Requirement level option of that attribute to No Constraint.
Anyone can set requirement level via JavaScript on the form at runtime. The requirement level of attributes can dynamically modify based on a selection in the system, another field could become required. Also if the selection changes again, then the field should not be required anymore.
The following code demonstrates for making a field optional, recommended or required :
// Set field to not required crmForm.SetFieldReqLevel("FieldName", 0); // Set field to business recommended crmForm.SetFieldReqLevel("FieldName ", 1); // Set field to business required crmForm.SetFieldReqLevel("FieldName ", 2);