locked
CRM 2013 - C# Plugin Firing When Not Required RRS feed

  • Question

  • Hi All

    I have a C# Plugin that is registered on update of sales order, however when I am in Quote entity and click the button 'Create Order' the plugin is being fired. Which is causing issues as the attributes required for the plugin are not in Quote.

    I have tried the following but so far have been unsuccessful

     if (context.MessageName == "Create")
                    {
                        return;
                    }
                    else
                    {
                       //Plugin Code
                    }


    S.Harrison

    Friday, May 29, 2015 8:22 AM

All replies

  • Hello Shaun,

    The reason your plugin fires when you create an Order from Quote is that the Order is Saved automatically and when Opens the form for you is already as Update and your Plugin fires. That's the reason why your code above is not working as well. You could try use additional checking on the form to see if is filled like you want it to be before execute the rest of your code.

    Hope that helps.

    Monday, June 1, 2015 8:47 AM
  • Following on from the previous post, if the plugin is only registered on the Update message, then a check on the context.MessageName won't help. Instead, you can check which attributes are in the Target InputParameter, and these should help distinguish between this scenario, and those when you want to run the plugin code.

    Also, have you set the FilteringAttributes on the plugin step to restrict which attributes it runs from ?


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

    Monday, June 1, 2015 1:41 PM
    Moderator