locked
Plugin running When Activating the record in mscrm 2011 RRS feed

  • Question

  • Dear ALL,

    I have a plugin registered on case entity for on update of a particular field but when i deactivate it and re activate it the plugin is running how can i stop it

    Tuesday, October 9, 2012 10:18 AM

Answers

  • Hi,

    have you registered your plugin to the update message? If that is the case, then it is firing because activate/deactivate also counts as an update to the entity. In order to avoid the plugin being fired you can use some kind of check on the "Status" field, something like this:

    var case = (Entity)pluginContext.InputParameters["Target"];
    
    if (case.Contains("statecode"))
    {
       return;
    }

    or check if the entity only contains changes to the attributes you want to track.

    Greetings,

    Pavlos


    Please mark this reply as an answer and vote it as helpful if it helps you find a resolution to your problem.

    • Marked as answer by anwar_addi Wednesday, October 10, 2012 9:51 AM
    Tuesday, October 9, 2012 12:25 PM