locked
preventDefault() method does not work for Qualify event on Lead RRS feed

  • Question

  • Hi,

    Recently I noticed that preventDefault(); doesn't work for Lead Qualify event.
    As per the msdn documentation the Save Event Mode value of Lead Qualify is 16 (http://msdn.microsoft.com/en-us/library/gg509060.aspx) when I try to check this event in OnSave method of Lead and if I get this event mode then I want to stop this event by using preventDefault(); but it didn't worked.

    Scenario: I have a duplicate detection activated on Lead hence whenever I try to Qualify a lead having potential duplicate Account/Contact, the duplicate detection dialog gets pop-up. Under certain conditions I want to prevent this event for getting fired so I used below code in my OnSave event but even though the code fires perfectly, I still received the Duplicate Detection dialog box which I shouldn't have received due to preventDefault() method.

    function Form_onsave(econtext) {
    var eventArgs = econtext.getEventArgs();
    alert(eventArgs.getSaveMode());
    // Check Event Mode is 16
    if(eventArgs.getSaveMode() == 16) {
    // Interrupt the Event
    eventArgs.preventDefault();
    // Event Interrupted
    alert('Qualify Cancelled');
    // Check the Interruption - Value "true"
    alert(eventArgs.isDefaultPrevented());

    /*Even though the Interruption is true I received Duplicate Detection box which means the event still went ahead and fired which was intended to be stopped*/
    }
    }

    I thought this to be an incorrect behavior and potential bug in CRM hence also went ahead and tried to put in on connect.microsoft.com but couldn't submit the form due to some potential bug there which always throws same error that mandatory fields are not filled in whereas all the fields are filled in.

    Anybody having some idea on this would be appreciated.

    Thanks a lot!


    Prathmesh If this post answers your question, please click "Mark As Answer" on the post and "Mark as Helpful" http://patelprathmesh.blogspot.com/

    Monday, June 23, 2014 8:23 PM