Asked by:
Error when using WF to send email to contacts in a sub grid "The email must have at least one recipient before it can be sent."

Question
-
Hi,
I work for a charity and we want to use our Dynamics 365 to support our fundraising team. We have created a 'Fundraising Event' entity with an N:N relationship to the Contact entity (renamed to 'Individual' in our Org. I have a sub grid on each entity so that we can add contacts to events either from the Contact record or from the event record.
We need to be able to send emails to everyone registered for an event to wish them good luck before the event. I have created a workflow against the 'Fundraising Event' entity to run 7 days before an event start date however when I an testing this the System job shows "Error; Needs Attention" and when I look at the process it shows a message "The email must have at least one recipient before it can be sent."
In the WF send email properties, I have tried using 'Contact' and 'Named Contact(Lookup)' from the list I have available (see screen shot below) in the TO field but I get the same result with both options.
My test event has 2 Individuals (Contacts) linked to it and I can see them both in the sub grid on the event record but I can't seem to be able to send emails to them.
Here are the details from a failed process:
Plugin Trace:[Microsoft.Xrm.Sdk.Workflow: Microsoft.Xrm.Sdk.Workflow.Activities.SendEmail]
[SendEmailStep1]Error Message:Unhandled Exception: System.ServiceModel.FaultException`1[[Microsoft.Xrm.Sdk.OrganizationServiceFault, Microsoft.Xrm.Sdk, Version=8.0.0.0, Culture=neutral, PublicKeyToken=31bf3856ad364e35]]: The e-mail must have at least one recipient before it can be sentDetail:
<OrganizationServiceFault xmlns:i="http://www.w3.org/2001/XMLSchema-instance" xmlns="http://schemas.microsoft.com/xrm/2011/Contracts">
<ActivityId>0f52f1a9-3d22-48ba-bc88-c56eafd6d87e</ActivityId>
<ErrorCode>-2147218684</ErrorCode>
<ErrorDetails xmlns:d2p1="http://schemas.datacontract.org/2004/07/System.Collections.Generic" />
<Message>The e-mail must have at least one recipient before it can be sent</Message>
<Timestamp>2017-03-31T08:45:07.2533286Z</Timestamp>
<ExceptionSource i:nil="true" />
<InnerFault>
<ActivityId>0f52f1a9-3d22-48ba-bc88-c56eafd6d87e</ActivityId>
<ErrorCode>-2147218684</ErrorCode>
<ErrorDetails xmlns:d3p1="http://schemas.datacontract.org/2004/07/System.Collections.Generic" />
<Message>The e-mail must have at least one recipient before it can be sent</Message>
<Timestamp>2017-03-31T08:45:07.2533286Z</Timestamp>
<ExceptionSource i:nil="true" />
<InnerFault i:nil="true" />
<OriginalException i:nil="true" />
<TraceText i:nil="true" />
</InnerFault>
<OriginalException i:nil="true" />
<TraceText>[Microsoft.Xrm.Sdk.Workflow: Microsoft.Xrm.Sdk.Workflow.Activities.SendEmail]
[SendEmailStep1]
</TraceText>
</OrganizationServiceFault>
at Microsoft.Crm.Workflow.Services.SendEmailActivityService.Execute(ActivityContext executionContext, SendEmail sendEmail)
at System.Activities.CodeActivity.InternalExecute(ActivityInstance instance, ActivityExecutor executor, BookmarkManager bookmarkManager)
at System.Activities.Runtime.ActivityExecutor.ExecuteActivityWorkItem.ExecuteBody(ActivityExecutor executor, BookmarkManager bookmarkManager, Location resultLocation)Is it possible to do what I'm attempting using out of the box functionality? If so, what am I missing?
Thanks,
Paul
Paul
- Edited by Paolo750 Friday, March 31, 2017 9:28 AM
Monday, March 27, 2017 11:53 AM
All replies
-
Hi Paul,
Please check if the individuals have email address specified. Also please check the following settings.
Go to Setting>Administrative>System setting>Email
allow messages with unresolved email recipient to be sent.
Monday, April 3, 2017 11:31 AM -
Hi Jithesh,
I am testing against 2 contacts in our test system and both have email addresses specified in the primary email field.
I've been in and checked the "allow messages with unresolved email recipient to be sent" setting and this is ticked.
Regards,
Paul
Paul
Monday, April 3, 2017 3:38 PM -
In the 'Look For' dropdown list in the send email worklfow step, do you see 'Individual' in that list? If you do, can you select that, and then select Email from the next list?
As a side note, I tend to shy away from N:N relationships because of their issues with not being able to execute workflows when you create a link between the records. Instead, look into creating a custom 'join' entity with a N:1 to contact and an N:1 to Event.
Also, have you looked into the built in Marketing List functionality? It's basically a way to build lists of contacts to send information to, somewhat similar to what you are doing.
Tuesday, April 4, 2017 1:23 PM