Hi Ricardo,
If you're working in UCI, then you could take below code as reference:
function onLoad(excontext) {
var formContext = excontext.getFormContext();
var formType = formContext.ui.getFormType();
// Check whether current opportunity has been closed.
if (formType == 3 || formType == 4) {
formContext.data.process.addOnPreStageChange(myFunction);
}
}
function myFunction(excontext) {
var alertStrings = { confirmButtonLabel: "Ok", text: "The opportunity has been closed.", title: "Notice." };
var alertOptions = { height: 150, width: 250 };
Xrm.Navigation.openAlertDialog(alertStrings, alertOptions).then(
function success(result) {
console.log("Alert dialog closed");
},
function(error) {
console.log(error.message);
}
);
excontext.getEventArgs().preventDefault();
return false;
}
If the current opportunity form is read-only, bind OnPreStageChange event to BPF,
then prevent user to move to next/previous stage by excontext.getEventArgs().preventDefault();
while user can still see other stages fields.
Regards,
Clofly