Not applicable

Error sending email to Person or Group field that allows multiple selections

Jump to solution

I've got multiple workflows that are configured to send an email to people in a Person or Group field that allows multiple selections.  When each workflow gets to this step it is suspended with the below error.  It seems to be throwing the error even if just one person is selected. For now I'm going to see if I can work around that by using different fields. 

By the way, there seems to be an issue with submitting support cases for o365 tenants. The License Key is not a required field, though if I leave it blank I get an error that the License Key field is invalid.  If I enter my Tenant ID in the license key field it also says the License Key is invalid.  I tried using IE and Firefox, but could not submit the form either way.

Error Message:

An unhandled exception occurred during the execution of the workflow instance. Exception details: System.InvalidCastException: The value 'd/results(0)/BDS_x002f_CSMId' cannot be read as type 'String'. at Microsoft.Activities.GetDynamicValueProperty`1.CheckedRead(String propertyName, DynamicItem value) at Microsoft.Activities.GetDynamicValueProperty`1.Execute(CodeActivityContext context) at System.Activities.CodeActivity`1.InternalExecute(ActivityInstance instance, ActivityExecutor executor, BookmarkManager bookmarkManager) at System.Activities.Runtime.ActivityExecutor.ExecuteActivityWorkItem.ExecuteBody(ActivityExecutor executor, BookmarkManager bookmarkManager, Location resultLocation) Exception from activity GetDynamicValueProperty<String> Sequence DynamicActivity<String> DynamicActivity<String> BuildCollection<String> DynamicActivity<Collection<String>>

Tags (1)
0 Kudos
Reply
3 Replies
TomaszPoszytek

Re: Error sending email to Person or Group field that allows multiple selections

Jump to solution

‌ I know it's been a while, but have you found a solution?

Reards,

Tomasz

0 Kudos
Reply
TomaszPoszytek

Re: Error sending email to Person or Group field that allows multiple selections

Jump to solution

This happens, because that field does not return you a single "Peeople or Group" item, but a Collection. I faced it as well.

To workaround it follow these steps:

  1. Assign the field as "Collection", using "Working email" as the property.
  2. Extract 0 element from the collection.
  3. It wil be as ["email1@domain.com","email2@domain.com","email3@domain.com"]
  4. Regex ',' --> ';' then remove quotes and brackets. You will receive such string: email1@domain.com;email2@domain.com;email3@domain.com (don't add any spaces).

With such string you can then assign a task, send an email or split it and then use in "foreach" loop.

Regards,

Tomasz

0 Kudos
Reply
jdniemi
Scholar

Re: Error sending email to Person or Group field that allows multiple selections

Jump to solution

Hello, old thread, but I am hoping there is a better way to do this action now. I could do what is explained above, but I do not want to send a separate email to each person in the group. This solution also has to work for 1 to x number of people in the SharePoint Multi Person field. 

 

My thought is to assign the field to a collection variable in the workflow, loop through collection and write email address to a new variable to contain a string of email1;email2;email3...

 

Will this work, is there an easier way or am I stuck with the individual emails?

 

Thanks!

0 Kudos
Reply