I need to fire extensible framework in record view of the Word Order screen such that when workorderstatus is made to "completed" and then the record is saved, I want to make the "udfchar23" field to be protected. I'm using the aftersaverecord function for that.
But when I click on the save button after changing the status to completed & there are some errors on the screen (like some other fields present on other tabs need to be filled in etc.), then I don't want the "udfchar23" field to become protected. But in the below code, it becomes protected even then. Is there a way to avoid that??
aftersaverecord: function(){
console.log("Triggered after save function");
//var vField1 = field.getValue(),
vFormPanel = this.getFormPanel();
try {
var var1 = vFormPanel.getForm().findField("workorderstatus");
var var2 = var1.getValue();
console.log(var2);
var min_sev = vFormPanel.getForm().findField("udfchar21");
var min_sev_level = min_sev.getValue();
console.log("Min Sev Level");
console.log(min_sev_level);
if (min_sev_level == '1' || min_sev_level == '2') {
if (var2 == 'C') {
EAM.Builder.setFieldState({'udfchar24':'protected'},vFormPanel.getForm().getFieldsAndButtons());
EAM.Builder.setFieldState({'udfchar23':'protected'},vFormPanel.getForm().getFieldsAndButtons());
}
}
}
catch(err) {
console.log("Inside catch for afterloaddata function, doing nothing");
console.log(err);
}
}