1
votes

I have a scenario where I have to integrate CRM with Sendgrid email system. I need to add information to email header of outgoing email for tracking.

I decided to bypass email router and directly send email via sendgrid API using Plugin registered on SEND message of EMAIL entity. Plugin works fine when a user sends an email from CRM UI and a email is delivered to intended recipient via Sendgrid API call.

The issue is plugin is not invoked if the email is being sent as a part of a workflow process, custom code activity or custom Plugin. I have tried attaching debugger while the execution of workflow but the pointer does not intercept the code.

Did anyone else faced anything like this?

1
Hello, Please provide a screenshot of workflow, code of custom workflow activity or plugin that used to send an email.Andrew Butenko
Hi Andrii, There is no specific workflow that is having the issue. any email that is not sent through CRM UI and is sent through a workflow, Plugin is not hitting the POST- OPERATION plugin registered on SEND message in EMAIL entity. The Plugin is hit by the email sent by CRM Web UI by clicking the SEND button. This is a strange behavior. I do not understand why is the plugin is working for email send through WEB UI and not for email sent through Plugin or Workflow.Manu Sharma
Plugin Code- <Code>Manu Sharma
Edit initial post with code. Code is not visible in comments.Andrew Butenko
Hi Manu! Having the same problem. Where you able to solve?Joao Leme

1 Answers

0
votes

Removing code below allowed plugin to run on

//if (context.Depth > 1) return;

Check if you are returning on context.Depth and remove or increase the Depth number.