The alert function in the onsave of the form and it was working fine, but after adding to the ribbon button, the alert will pop up even if required fields are not filled, if i click on button and if req field is not filled, still the alert will pop up? do i need to modify my below code?
setFieldValue: function (primaryControl) {
var formContext = primaryControl;
var formContext = primaryControl.getFormContext(); //before i used executioncontext.getFormContext();
formContext.getAttribute("assessmentsubmited").setValue("Assessment Submitted button clicked");
var alertStrings = { confirmButtonLabel: "", text: "Your Request has been successfully raised !!", title: "Confirmation" };
var alertOptions = { height: 120, width: 260 };
if (formContext !== null) {
Xrm.Navigation.openAlertDialog(alertStrings, alertOptions);
}
}
when i used in onsave event it was working but used executioncontext.getFormContext();
but now i removed from onsave and added same code but used primaryControl.getFormContext(); directly to the custom ribbon button and alert will pop up but if I dont fill the req field and Click on button, alert will still pop up which i dont want