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!!!


Filed under MS CRM 2011

9 responses to “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. Yiannis

    I really mean it, thank you o lot

  3. 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

  4. I am still getting the popup window

  5. Code was fine, but now I got another message “Are you sure, that you want navigate away from the page” 🙂

  6. PJ

    Much appreciated

Leave a Reply

Fill in your details below or click an icon to log in: Logo

You are commenting using your account. Log Out /  Change )

Twitter picture

You are commenting using your Twitter account. Log Out /  Change )

Facebook photo

You are commenting using your Facebook account. Log Out /  Change )

Connecting to %s