1

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?

  • Hello, Please provide a screenshot of workflow, code of custom workflow activity or plugin that used to send an email. – Andrew Butenko Feb 06 '16 at 13:00
  • 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 Feb 06 '16 at 18:49
  • Plugin Code- – Manu Sharma Feb 06 '16 at 18:56
  • Edit initial post with code. Code is not visible in comments. – Andrew Butenko Feb 07 '16 at 08:10
  • Hi Manu! Having the same problem. Where you able to solve? – Joao Leme Dec 21 '17 at 16:57

1 Answers1

0

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.

Joao Leme
  • 9,598
  • 3
  • 33
  • 47