Validate the Required fileds on MS CRM Form while saving from Custom Button

Some times we may use the Custom button to save the form. In this case using below function we can validate whether Required Form Fields are filled or not programmatically
function IsFormValidForSaving() {
var valid = true; (attribute, index) {
if (attribute.getRequiredLevel() == “required”) {
if (attribute.getValue() == null) {
if (valid) {
var control = attribute.controls.get(0);
alert(‘You must provide a value for’ + ‘ ‘ + control.getLabel());
valid = false;
return valid;




Leave a Reply

Fill in your details below or click an icon to log in: Logo

You are commenting using your account. Log Out /  Change )

Google+ photo

You are commenting using your Google+ account. Log Out /  Change )

Twitter picture

You are commenting using your Twitter account. Log Out /  Change )

Facebook photo

You are commenting using your Facebook account. Log Out /  Change )


Connecting to %s