none
Plugin rollback question - CRM 2011

    Question

  • Hi

    1) I have a pre-operation plugin on create of an entity. If the create fails, will the actions in the 'pre-operation' get rolled back ?

    2) If an update of an entity fails, will the actions in the post-update roll back?

    Thanks

    Tuesday, October 15, 2013 6:03 AM

Answers

  • Just to add to the previous post - your actions will be rolled back if the plugin is registered on stage = 20 or 40, as long as these updates are done using the IOrganizationService instance that you derive from the IPluginExecutionContext. If you create a separate instance, then these actions will be within a separate transaction

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

    • Marked as answer by IamaNovice Tuesday, October 15, 2013 7:19 PM
    Tuesday, October 15, 2013 3:04 PM
    Moderator

All replies

  • Hi,

    Please go through following links :

    http://msdn.microsoft.com/en-us/library/gg327941.aspx

    http://mscrmtools.blogspot.com/2011/01/crm-2011-plugins-welcome-to.html


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


    • Edited by _Vikram Tuesday, October 15, 2013 6:14 AM
    Tuesday, October 15, 2013 6:14 AM
  • Hi There,

    Yes, if your  plug-in is executing in the database transaction and allows an exception to be passed back to the platform, the entire transaction will be rolled back. Stages 20 and 40 are guaranteed to be part of the database transaction.

    Ranjeet!!!

    Tuesday, October 15, 2013 6:27 AM
  • Just to add to the previous post - your actions will be rolled back if the plugin is registered on stage = 20 or 40, as long as these updates are done using the IOrganizationService instance that you derive from the IPluginExecutionContext. If you create a separate instance, then these actions will be within a separate transaction

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

    • Marked as answer by IamaNovice Tuesday, October 15, 2013 7:19 PM
    Tuesday, October 15, 2013 3:04 PM
    Moderator