locked
How to trigger a plugin in Email Send Ribbon RRS feed

  • Question

  • hi,

    I need to trigger a plugin in Email entity and the plugin has to get trigger when i click send .

    i have registered my plugin message in send and entity as Email . 

    but my plugin doesn't get fired. 

    Any Idea . .

    Grateful for any help!!

    Tuesday, September 3, 2013 1:21 PM

Answers

  • "if (context.MessageName.Equals("Update"))" This is incorrect when the message is 'Send' or 'SetState'

    If my response helped you find your answer please show your thanks by taking the time to "Mark As Answer" and "Vote As Helpful".

    Twitter LinkedIn Facebook Blog Magnetism

    • Marked as answer by kMAT1 Wednesday, September 4, 2013 1:18 PM
    Wednesday, September 4, 2013 9:57 AM

All replies

  • Hi 

    Try this link I am sure it will help you.

    http://code.msdn.microsoft.com/Trigger-a-Plug-in-in-75699228

    Tuesday, September 3, 2013 1:41 PM
  • any updates . . . .!!!!
    Wednesday, September 4, 2013 6:00 AM
  • Try running the plugin async, or if that still doesn't work try registering the plugin on SetState and SetStateDynamicEntity. Then in the plugin check if it's 'Sent'.

    If my response helped you find your answer please show your thanks by taking the time to "Mark As Answer" and "Vote As Helpful".

    Twitter LinkedIn Facebook Blog Magnetism

    Wednesday, September 4, 2013 6:19 AM
  • Hi Paul Nieuwelaar,

    as you said i have registered my plugin both SetState and SetStateDynamicEntity in Email entity. 

    but still it din trigger. 

    as far i tried , i am not able to trigger my plugin in send message in Email entity. 

    may i know why this issue happen. 

    Wednesday, September 4, 2013 7:46 AM
  • Post your code.

    If my response helped you find your answer please show your thanks by taking the time to "Mark As Answer" and "Vote As Helpful".

    Twitter LinkedIn Facebook Blog Magnetism

    Wednesday, September 4, 2013 9:32 AM
  •  public void Execute(IServiceProvider serviceProvider)
            {
                IPluginExecutionContext context = (IPluginExecutionContext)serviceProvider.GetService(typeof(IPluginExecutionContext));



                IOrganizationServiceFactory serviceFactory = (IOrganizationServiceFactory)serviceProvider.GetService(typeof(IOrganizationServiceFactory));
                IOrganizationService service = serviceFactory.CreateOrganizationService(context.UserId);

                if (context.MessageName.Equals("Update"))
                {
                    if (context.PostEntityImages.Contains("Target"))
                    {
                        Entity Email= (Entity)context.PostEntityImages["Target"];

                        EntityReference reguarding = (EntityReference)Email.Attributes["regardingobjectid"];

              // Logic 

    }

    }

    plugin it self not getting fired. 

    I tried to debug my code  , I can able to get "Busciness Process Error" , but itz not running while debug.

    http://guruprasadcrm.blogspot.in/2011/11/how-to-debug-crm-2011-online-plugin.html

    if i registered my plugin in other step it works. 

    as far i know , my plugin it self not fired . 

              
    Wednesday, September 4, 2013 9:50 AM
  • "if (context.MessageName.Equals("Update"))" This is incorrect when the message is 'Send' or 'SetState'

    If my response helped you find your answer please show your thanks by taking the time to "Mark As Answer" and "Vote As Helpful".

    Twitter LinkedIn Facebook Blog Magnetism

    • Marked as answer by kMAT1 Wednesday, September 4, 2013 1:18 PM
    Wednesday, September 4, 2013 9:57 AM