locked
ErrorCallback on save.then not firing if there is a plugin error RRS feed

  • Question

  • Hi All,

    I am using the below code on a ribbon control. The successCallback shows the notification but errorCallback doesn't get called or shows the notification if there is a plugin error. I don't want the Business Process Error alert rather want to show the message in notification. Please suggest if this can be achieved.

    Thanks

    Girish

    function

    updateApplicationStatus(status)

    {

        Xrm.Page.getAttribute(

    "new_applicationstatus").setValue(status);

        Xrm.Page.data.save().then(toAppstatusSuccessCallback, toAppstatusErrorCallback);

    }


    function

    toAppstatusSuccessCallback()

    {

        Xrm.Page.ui.setFormNotification(

    "Application Validated Successfully !!!","INFO", "toValidationProcessNotification");

    }



    function

    toAppstatusErrorCallback(errorcode, errorMessage)

    {

        Xrm.Page.ui.setFormNotification(errorMessage,

    "ERROR", "toValidationProcessNotification");

    }


    Girish Tripathi Sharepoint 2010 Developer

    Tuesday, March 11, 2014 5:45 AM

All replies

  • Girish,

    You have not provided details about your process, but assuming you are using synchronous plugin (which is running in transaction) and when error will come it will rollback all changes and will throw error. you can't update any field because after that error, it won't allow you to do anything.

    HTH


    Our Website | Our Blog | Follow US | My Facebook Page | Microsoft Dynamics CRM 2011 Application Design
    Make sure to "Vote as Helpful" and "Mark As Answer",if you get answer of your question.

    Tuesday, March 11, 2014 7:50 AM
    Moderator