locked
How to Clear field data on Plug-in fail MS CRM 2015 U1 RRS feed

  • Question

  • Hi Experts,

    When plug-in exception occurred, still newly added/modified field data still exists on the form. I would like to clear the newly added data when plug-in failed.

    Please help me out.

    Thanks & Regards

    Baji Rahaman

    Wednesday, November 4, 2015 2:41 AM

All replies

  • Hi Baji,

        Can you provide more information about when your plugin is firing? Also, is it firing pre-validation, pre-operation or post-operation? What is the plugin throwing an exception on?

    John

    Wednesday, November 4, 2015 3:47 AM
  • Hi John,

    Thanks for you reply.

    steps below:

    1. Opened existing record and entered some value in single line text.

    2. Save the record.

    3.Some exception occurred in Post Update Plug-in and displaying the plug-in error message on application.

    When I close the error, system should clear the data that I entered in point1.

    Thanks & Regards

    Baji Rahaman

    Wednesday, November 4, 2015 4:09 AM
  • Hi Baji,

        Thanks for the information. You stated that your plugin is firing post-update. This means that the update on the CRM record has already been committed, so an exception in the plugin will not clear out the data that caused the plugin to fire. If you want the data being updated to not be saved with the form if the plugin fails, change your plugin to fire on pre-update.

    Hope that helps.

    John

    Wednesday, November 4, 2015 4:15 AM
  • Hi John,

    I don't think changes has been committed yet because plug-ins run under transaction. When some exception occurred data will not be sit in DB.

    I need to clear data on the form which is not committed to the DB yet when some error occurred in Plug-in.

    Thanks & Regards

    Baji Rahaman

    Wednesday, November 4, 2015 5:32 AM
  • Hi Baji,

    You can have error call back method and in error call back if you refresh your CRM form then user will see previous values, please refer following article for this

    http://crmkitchen.com/save-form-callback-function-crm-2015/

    Hope this helps..


    MayankP
    My Blog
    Follow Me on Twitter

    Wednesday, November 4, 2015 9:57 AM