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.
Hope this helps. Please drop some comments if script is helpful.
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
Note: The above code is not supported by Microsoft.

6 comments:
nice post.
Superb article .Easy way to achieve my requirement.Nice
Iam facing one issue while Converting Custom Entity to Lead.The activites of Custom Entity is not copied to Lead.Plz help
worked perfectly fine :) thank u
perfect way to fix my problem :)
keep it up!
The field on Form becomes business recommended when I change the related field, but if I remove the value in the related field the other field does not revert back to not required. I need it to change back to not required. I hope you can help and look forward to your answer!
Post a Comment