I have a situation where if the user is marking an activity as complete, certain fields become mandatory. So on Save, I check the save mode, and then if Mark Complete, and if fields aren't filled in, alert the user and prevent the save. This is all fine, however, if the user clicks Mark Complete a second time, no javascript is fired (and no save is performed). Clicking Save does work though?? You can try it out, on say, the Task activity.
Here is the code to attahc to Form OnSave:
function CheckMandatory(executionObj)
{
if (executionObj.getEventArgs().getSaveMode() == 58) {
if (Xrm.Page.getAttribute("description").getValue() == null) {
alert("Description is mandatory when completing activity");
executionObj.getEventArgs().preventDefault();
return false;
}
}
}
*This post is locked for comments
I have the same question (0)