Quantcast
Channel: Microsoft Dynamics CRM Forum - Recent Threads
Viewing all articles
Browse latest Browse all 82002

Getting null reference exception at Guid emailId = service.Create(email);

$
0
0

Hi,

I want to send an email from a custom workflow. for that, I have written code.

email.From = new[] { fromParty };
email.To = new[] { toParty };

tracingService.Trace("To and From are added ");
email.RegardingObjectId = new EntityReference(Incident.EntityLogicalName, caseEntity.Id); 
Guid emailId = service.Create(email);
SendEmailRequest sendRequest = new SendEmailRequest();
sendRequest.EmailId = emailId;
sendRequest.TrackingToken = string.Empty;
sendRequest.IssueSend = true;
service.Execute(sendRequest);

But when I changed email.RegardingObjectId code I got nullreference exception.

email.RegardingObjectId = new EntityReference(ActivityParty.EntityLogicalName, emailEntity.Id); //This line //throws exception.


Viewing all articles
Browse latest Browse all 82002

Latest Images

Trending Articles



Latest Images