Exception in update plugin is swallowed when the owner of the record is changed RRS feed

  • Question

  • Hi,

    I have a plugin registered on update message which validates the input from field XX and throw business exception to the user if the value which is updated is invalid. However when the record is update with change of owner this exception is not shown to the user. Instead the form gets refresh and values are reverted back. 

    I'd like to know if anyone had similar experience and what was the solution.


    Tuesday, May 27, 2014 10:43 PM

All replies

  • Just adding to my post I thought it worth mention that, not even plugin profile is throwing exception when the owner is updated.
    Tuesday, May 27, 2014 11:19 PM
  • Hello,

    What message do you handle with plugin? Update? If yes - during change of owner Assign message is used instead of Update.

    Dynamics CRM MVP/ Technical Evangelist at SlickData LLC
    My blog

    Wednesday, May 28, 2014 4:10 AM
  • Hi Andrii,

    Thanks for your reply, Yes the plugin has a step to handle the Update message. However I thought of assignment message and added another step to handle Assign message. But the issue still remain. I also tried to debug the plugin on the server and the code is throwing the exception but some how CRM application is swallowing it if the owner is updated. But if the owner is not updated I get the exception thrown from the code in CRM application.

    Wednesday, May 28, 2014 6:41 AM
  • Could you please provide code of your plugin?

    Dynamics CRM MVP/ Technical Evangelist at SlickData LLC
    My blog

    Wednesday, May 28, 2014 6:45 AM
  • If only owner is updated, I am not sure if the Update message will be fired. However, if you are expecting the field to be validated as well in the plugin, I would suggest to force submit that field every time so that you can hit the Update plugin.
    Wednesday, May 28, 2014 6:39 PM
  •         public void Execute(IServiceProvider serviceProvider)
                throw new Exception();

    I used the above code in my plugin and registered the plugin for both Update & Assign message. No matter what stage is selected for the plugin to get triggered, when owner of the record is updated I don't see the exception on CRM application. I even tried to update "ownerid" from a console application which gave me the exception. Taht means exception is raising, but some how the CRM application swallows it whenever owner is updated. Could it be a bug in CRM?

    Wednesday, May 28, 2014 10:49 PM
  • I tried your suggestion but no luck :-)
    Thursday, May 29, 2014 9:28 AM