Quantcast
Channel: CRM Development forum
Viewing all articles
Browse latest Browse all 8223

Mail always go to draft status when trigger mail from plugin

$
0
0

Hi,

I have created one plugin for find out the closed case in the CRM. I need trigger the email to customer while their case is closed.

I have used below code for that. I will trigger the mail correctly but the mail was save as draft by default. What can do I need the mail send without saving as draft

 string ownerId = "8bf52f05-8f13-e311-a612-00155d00ee04";
 Guid ownid = new Guid(ownerId);
 Guid custId = new Guid("a8f2037f-9814-e311-a612-00155d00ee04");
 Guid accid = new Guid("0c1ddfe7-9c13-e311-a612-00155d00ee04");
 Entity fromParty = new Entity("activityparty");
fromParty["partyid"] = new EntityReference("systemuser", ownid);
Entity toParty = new Entity("activityparty");
toParty["partyid"] = new EntityReference("contact", custId);
Entity Email = new Entity("email");
Email.Attributes["from"] = new Entity[] { fromParty };
 Email.Attributes["to"] = new Entity[] { toParty };
Email.Attributes["subject"] = "Your Case have closed";
Email.Attributes["regardingobjectid"] = new EntityReference("account", accid);
Email.Attributes["description"] = "subject";
Email.Attributes["ownerid"] = new EntityReference("systemuser", ownid);
Guid EmailId = service.Create(Email);
SendEmailRequest req = new SendEmailRequest();
req.EmailId = EmailId;
req.IssueSend = true;
req.TrackingToken = "";
SendEmailResponse res = (SendEmailResponse)service.Execute(req);


Ravin Singh D


Viewing all articles
Browse latest Browse all 8223

Trending Articles



<script src="https://jsc.adskeeper.com/r/s/rssing.com.1596347.js" async> </script>