Quantcast
Channel: Microsoft Dynamics CRM Forum - Recent Threads
Viewing all articles
Browse latest Browse all 55831

Mark complete won't fire again after preventDefault called

$
0
0

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;
    }
  }
}


Viewing all articles
Browse latest Browse all 55831

Trending Articles



<script src="https://jsc.adskeeper.com/r/s/rssing.com.1596347.js" async> </script>