Bazı durumlarda formun kaydedilmesi için custom buttonlar kullanabiliriz. Bu gibi durumlarda kendi kontrolumuzu yapmaya ihtiyacımız oldugunda aşagıdakı metodu kullanabiliriz.
function IsFormValidForSaving() {
    var valid = true;
    Xrm.Page.data.entity.attributes.forEach(function (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());
                    control.setFocus();
                }
                valid = false;
            }
        }
    });
    return valid;
}
 
Hiç yorum yok:
Yorum Gönder