On possible way is to use if-else statement to check if field.DataValue == null or not and respond accordingly. But following code can be used to make fields not required, required and business recommended.
- crmForm.SetFieldReqLevel("fieldname",0); // set field to not required
- crmForm.SetFieldReqLevel("fieldname",1); // set field to required/mandatory
- crmForm.SetFieldReqLevel("fieldname",2); // set field to business recommended.
Hope this helps. Please drop some comments if script is helpful.
Note: The above code is not supported by Microsoft.
