locked
Disabling Auto-Save for a particular Entity RRS feed

  • Question

  • Hi All

    I disabled auto-save for a particular entity to prevent the occurnce of plugins repetedly.But,on disabling Auto-save for a particular entity,and if i made changes and if i didn't click on save button and if i am popping out for another record,then the record is saving automatically,and the alert is not coming saying there are unsaved changes,and OK/Cancel buttons .how to handle this?



    • Edited by manasat Monday, December 14, 2015 9:54 AM -
    Monday, December 14, 2015 9:22 AM

Answers

  • Hi David

    with the below code :Working fine.

    function preventAutoSave(context) {

        var eventArgs = context.getEventArgs();

        if (eventArgs.getSaveMode() == 70 || eventArgs.getSaveMode() == 2) {//Form AutoSave Event

            eventArgs.preventDefault();//Stops the Save Event

        }

    }

    Thank you.

    • Marked as answer by manasat Thursday, December 17, 2015 10:16 AM
    Thursday, December 17, 2015 10:16 AM

All replies

  • How are you disabling AutoSave for the entity ? If it via javascript, try debugging to check the code is working correctly

    Microsoft CRM MVP - http://mscrmuk.blogspot.com/ http://www.excitation.co.uk

    Monday, December 14, 2015 10:19 AM
    Moderator
  • Hi David

    I am disabling by adding the below function in OnSave event of the entity

    function preventAutoSave(context) {

        var eventArgs = context.getEventArgs();

        if (eventArgs.getSaveMode() == 70) {//Form AutoSave Event

            eventArgs.preventDefault();//Stops the Save Event

        }

    }

    it is working fine,but if i pop-outs of the record or closing the record without clicking save also ,it is saving automatically.any way to handle this?



    • Edited by manasat Monday, December 14, 2015 10:36 AM -
    Monday, December 14, 2015 10:35 AM
  • You can refer this page

        http://www.powerobjects.com/2015/01/19/how-to-disable-autosave-for-an-individual-dynamics-crm-2013-form/


    Thanks Regards Prashanth Kamasamudram Even the least work done for others awakens the power within; even thinking the least good of others gradually instills into the heart the strength of a lion.

    Wednesday, December 16, 2015 9:24 AM
  • The code should work the same if you pop-out the form, or navigate away from it. What happens if you debug the code - does the function get called in these scenarios, and if so, what are the values of context.getEventArgs() and
    eventArgs.getSaveMode() ?

    Microsoft CRM MVP - http://mscrmuk.blogspot.com/ http://www.excitation.co.uk

    Wednesday, December 16, 2015 2:13 PM
    Moderator
  • Hi David

    with the below code :Working fine.

    function preventAutoSave(context) {

        var eventArgs = context.getEventArgs();

        if (eventArgs.getSaveMode() == 70 || eventArgs.getSaveMode() == 2) {//Form AutoSave Event

            eventArgs.preventDefault();//Stops the Save Event

        }

    }

    Thank you.

    • Marked as answer by manasat Thursday, December 17, 2015 10:16 AM
    Thursday, December 17, 2015 10:16 AM