web
You’re offline. This is a read only version of the page.
close
Skip to main content

Notifications

Announcements

No record found.

Community site session details

Community site session details

Session Id :
Microsoft Dynamics 365 | Integration, Dataverse...
Answered

On Demand Flows - Send email to selected records (Contacts)

(0) ShareShare
ReportReport
Posted on by 50

Hi all,

I am struggling with an error that is getting the better of me!

The execution of template action 'Apply_to_each' failed: the result of the evaluation of 'foreach' expression '@outputs('Get_record')?['body/contactid']' is of type 'String'. The result must be a valid array.

All I want to do is create an On Demand Flow where we can email selected contacts with an email!

Any successful examples greatly appreciated!

Scenario:

Select contact records, run on demand flow, send email to each of them.  This was REALLY easy in Workflows, why so difficult in Flows...

Calling out to Elaiza Benitez to show me the way!!

I have the same question (0)
  • Suggested answer
    LuHao Profile Picture
    40,892 on at

    Hi Mark,

    • In flow, the To field must be a specific email address, such as luhao@test.com.
    • In the workflow, the To field is contact records.

    This is the difference between the two of them.

    So, we need to populate the To field in flow with the value of the Email field and no longer the GUID of the contact.

    pastedimage1612752564192v1.png

  • Mark.Fletcher Profile Picture
    50 on at

    Hi Hao!

    Good to hear from you again!  Always straight forward guidance thanks.

    Can you just please verify that the "Get a Row" action has to point to the USERS table?

    I imagined it would need to get rows from the Contacts table??

    If the Table does need to be Users, could you perhaps provide me with a simple explanation behind that?

    Cheers,

    Mark

  • Verified answer
    LuHao Profile Picture
    40,892 on at

    Hi Mark,

    The "Get a row" action is not necessary, here it is used to get the Owner's first name, which is used as the last signature in the body of the email.

    If you don't need to use Owner as a signature, then you can leave out the "Get a row" action.

    The following are the simplest steps to send emails in flow.

    pastedimage1612836096456v1.png

    If you want to get the field value of Contact's related entity and add them to the email body, then we need to use the "Get a row" action to get all the fields of the record, just like I did before to get the first name from Owner (User).

  • Mark.Fletcher Profile Picture
    50 on at

    Hao,

    Thanks!! I now understand how the "Get a Row" is optional (just to grab related entity data - or do we call them tables these days?!!).

    You have verified for me the simplest of requirements, and all tests have gone well!  Amazing how we can so easily assume it needs to be more complicated..

    I think I learnt a big lesson when originally adding in "List Records"!!!!! I got hundreds of emails sent to me quoting everyone's first name!  Ha Ha!!

    Thankfully I had not gone live with it!

    Lesson learnt is "Use the RIGHT action for the task!"

    Once again thanks for your clear guidance, greatly appreciated, especially when there is NO mention of Javascript...!!

    Faith restored, thanks.

    Mark

  • LuHao Profile Picture
    40,892 on at

    Hi Mark,

    Glad to hear that.

    Cheers!

Under review

Thank you for your reply! To ensure a great experience for everyone, your content is awaiting approval by our Community Managers. Please check back later.

Helpful resources

Quick Links

Responsible AI policies

As AI tools become more common, we’re introducing a Responsible AI Use…

Neeraj Kumar – Community Spotlight

We are honored to recognize Neeraj Kumar as our Community Spotlight honoree for…

Leaderboard > Microsoft Dynamics 365 | Integration, Dataverse, and general topics

#1
#ManoVerse Profile Picture

#ManoVerse 93

#1
Siv Sagar Profile Picture

Siv Sagar 93 Super User 2025 Season 2

#3
Martin Dráb Profile Picture

Martin Dráb 62 Most Valuable Professional

Last 30 days Overall leaderboard

Product updates

Dynamics 365 release plans