locked
crm2013 - javascript - stop the save event RRS feed

  • Question

  • first thing i don't speack about the auto-save system and all the code to diseable the save on a form

    i was used the : 

     event.returnValue = false; 

    to block the save event when i have check a condition.

    want to know what is the new way to stop the save event on crm2013 because this code doesn't work.

    language : JavaScript

    thks

    Tuesday, December 3, 2013 12:39 PM

All replies

  • Hi,

    Try the below code:

    ExecutionObj.getEventArgs().preventDefault();

    I hope this resolves your issue.

    Thanks & Regards,


    Anubhav Bajpai

    Tuesday, December 3, 2013 12:41 PM
  • Please check this

    http://community.dynamics.com/crm/b/crmmitchmilam/archive/2011/05/06/crm-2011-canceling-the-save-operation.aspx


    Hope this helps. If you get answer of your question, please mark the response as an answer and vote as helpful !!!
    Vikram Singh. !!!  My Blog

    • Marked as answer by beniusb Tuesday, December 3, 2013 1:17 PM
    • Unmarked as answer by beniusb Monday, December 16, 2013 1:50 PM
    Tuesday, December 3, 2013 12:49 PM
  • that just block that final save action for plugin but that can't block the fonction call 
    i explain my self.

    if i call fonction:

    1- block_save

    2- action_A

    3- action_B

    when the function 1 should stop the save action i search to block the 2 and 3 action who call after 1

    i search a good replacement of the 2011 function 


    • Edited by beniusb Monday, December 16, 2013 1:57 PM error on text
    Monday, December 16, 2013 1:56 PM
  • Call this In the Form Properties window, in the Event Handlers section, set Event to OnSave.

    function preventAutoSave(econtext) {
        var eventArgs = econtext.getEventArgs();
        if (eventArgs.getSaveMode() == 70) {
            eventArgs.preventDefault();
        }
    }
    

    Monday, December 16, 2013 4:57 PM