CRM 2016 Deactivate plugin does not fire when records merged RRS feed

  • Question

  • Hi,

    I have a plugin that fired when the record is deactivated.

    Below is the code -

        if (context.InputParameters.Contains("EntityMoniker") && context.InputParameters["EntityMoniker"] is EntityReference)
                         EntityReference EntityRef = (EntityReference)context.InputParameters["EntityMoniker"];

        //code continues


    And i have registered the plugin on SetState and SetStateDynamicEntity steps.

    The plugin fires when the record is directly activated or deactivated. However when the 2 records are merged, the other record gets deactivated, at this point, the deactivation plugin does not work.

    Kindly suggest.

    Monday, January 2, 2017 1:16 PM


  • During a merge, the deactivation of the subordinate record is an internal operation, which I expect is why it does not cause your plugin to fire.

    I expect you'll also have to register your plugin on the Merge message. You'll probably also have to change your code a little to read the primary key of the record to deactivate from the SubordinateId InputParameter 

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

    • Marked as answer by shradha_singh Tuesday, January 24, 2017 1:45 PM
    Tuesday, January 3, 2017 9:39 AM