Hello,

I want to customize disqualify lead button in a way that when specific status reason is selected on disqualify button i want to check one field on form whether value contains if not show alert message and make field required.

i have tried this on save event of form with below code but iam not getting selected status reason value instead of that iam getting initial loaded value.

Please suggest is there way to get selected status reason value or any other possible way to handle this??

if (executionContext.getEventArgs().getSaveMode() ==15 && formContext.getAttribute("statuscode").getValue() == 4 )
{
executionContext.getEventArgs().preventDefault();
formContext.getAttribute("contact").setRequiredLevel("required");
var alertStrings = { confirmButtonLabel: "Ok", text: "contact is Required", title: "Required" };
var alertOptions = { height: 120, width: 260 };

Xrm.Navigation.openAlertDialog(alertStrings, alertOptions).then(
function success(result) {
console.log("Alert dialog closed");
},
function (error) {
console.log(error.message);
}
);


}