Hi, I have this plugin which triggers on update of specific status reason. Instead of triggering directly when saved, I used an OnSave Jscript for a confirmation dialog. The process needs to be saved only when Call back is YES, if it is yes then I want another alert box to show the process is successful. After the record is saved I want it to be Read-only( still record would be active) , even when the record is accessed later. Here is the Jscript I have been using OnSave.
function confirmOpp(context) {
if (Xrm.Page.getAttribute("statuscode").getValue() == 100000000) {
Xrm.Utility.confirmDialog("Click OK to run the process or Cancel to go back. Ok ?", function () {
alert("Operation Successful");
Xrm.Page.data.entity.attributes.forEach(
function (attribute, index) {
if (Xrm.Page.getControl(attribute.getName()) != null) {
Xrm.Page.getControl(attribute.getName()).setDisabled(true);
}
});
}, function () {
var saveEvent = context.getEventArgs();
saveEvent.preventDefault();
});
}
}
I wrote the above code, It executes successfully the first time. Once the for becomes read only, and when tried to refresh or go back. the Confirm dialog pops up again saving the form again. Also, when I go back and check the record, it is not read-only anymore. Please help me if I have to change anything in my script. And I only want to achieve it using JScript. Thanks in advance.
*This post is locked for comments
I have the same question (0)