Close MS CRM 2011 Form using JS

Some time we need to validate based on their input values and need to close crm form if they are not validated, we can do this validation through plugin but, we can’t close form through plugin. So Javascript comes in picture here. We can do this through JS code. To close ms crm form we have close method available, we can use it like below


But if you will use this statement, you will get a prompt like below


to stop this prompt you need to use getSubmitMode method of attribute and need to set submitMode to never like below

 var attributes =;

  for (var i in attributes)

    {       attributes[i].setSubmitMode(“never”); }



Hope it will help somebody!!!

10 thoughts on “Close MS CRM 2011 Form using JS

  1. Chandan

    Thank you so much for the script to stop the prompt.. I was struggling for this..
    Thanks again ..


  2. Mostafa El Moatassem bellah

    Thanks alot for your help I used to do this in CRM 4 using window.close();
    but after upgrade it stopped working, so this will be very helpful


Leave a Reply

Your email address will not be published. Required fields are marked *