Answered by:
How to trigger a plugin in Email Send Ribbon

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
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
-
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 -
-
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 -