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

Notifications

Announcements

Community site session details

Community site session details

Session Id :
Power Platform Community / Forums / Power Automate / How to extract email a...
Power Automate
Unanswered

How to extract email addresses from a compose output

(0) ShareShare
ReportReport
Posted on by 9

Hi,

I have an invoice approval workflow which permits up to four separate approvers.  What I want to do is send an email once per day to anyone who has invoices pending approval.

 

Through a series of select and compose functions, I can get the following (valid) list of people who should receive an email reminder.  What I can't work out is how to extract the addresses for use in the 'To:' field of a 'Send Email' step.  Any assistance would be appreciated.

 

[
{
"E1": "Dxx@xxxxxxxxxxx.org.nz"
},
{
"E1": "axxxxxxxx@xxxxxxxxxxx.org.nz"
},
{
"E1": "Rxxxx@xxxxxxxxxxx.org.nz"
},
{
"E1": "fxxxxx@xxxxxxxxxxx.org.nz"
},
{
"E2": "Dxxxx@xxxxxxxxxxx.org.nz"
},
{
"E2": "axxxxxx@xxxxxxxxxxx.org.nz"
},
{
"E2": "nxxx@xxxxxxxxxxx.org.nz"
},
{
"E2": "Hxxxx@xxxxxxxxxxx.org.nz"
},
{
"E3": "fxxx@xxxxxxxxxxx.org.nz"
},
{
"E3": "Hxxxxx@xxxxxxxxxxx.org.nz"
},
{
"E4": "nxxx@xxxxxxxxxxx.org.nz"
},
{
"E4": "axxxxxx@xxxxxxxxxxx.org.nz"
}
]
Categories:
I have the same question (0)
  • Verified answer
    Paulie78 Profile Picture
    8,422 Moderator on at

    This would normally be very easy, but the naming of elements within your array are different throughout the array (E1, E2 etc). So you have to use an expression. This does what you want:

    2021-05-25_06-05-45.png

    In the select action the "From" should be the compose that contains your email addresses. Then put the select into text mode, use this expression:

    replace(substring(string(item()),7), '"}', '')

    This is going to give you back a simple array that looks like this:

    [
     "Dxx@xxxxxxxxxxx.org.nz",
     "axxxxxxxx@xxxxxxxxxxx.org.nz",
     "Rxxxx@xxxxxxxxxxx.org.nz",
     "fxxxxx@xxxxxxxxxxx.org.nz"
    ]

    You can then use a compose action on the output of the select:

    join(body('Select'), ';')

    which will produce output like:

    Dxx@xxxxxxxxxxx.org.nz;axxxxxxxx@xxxxxxxxxxx.org.nz;Rxxxx@xxxxxxxxxxx.org.nz;fxxxxx@xxxxxxxxxxx.org.nz;Dxxxx@xxxxxxxxxxx.org.nz;axxxxxx@xxxxxxxxxxx.org.nz;nxxx@xxxxxxxxxxx.org.nz;Hxxxx@xxxxxxxxxxx.org.nz;fxxx@xxxxxxxxxxx.org.nz;Hxxxxx@xxxxxxxxxxx.org.nz;nxxx@xxxxxxxxxxx.org.nz;axxxxxx@xxxxxxxxxxx.org.nz

    Which you can use to email everyone at the same time.

    Blog: tachytelic.net

    YouTube: https://www.youtube.com/c/PaulieM/videos

    If I answered your question, please accept it as a solution 😘

  • DanNZ Profile Picture
    9 on at

    Thanks for the reply.  Working through this now.  I'm getting an "enter a valid json" message for the replace(substring(string(item()),7), '"}', '') step.

  • Paulie78 Profile Picture
    8,422 Moderator on at

    Did you enter that into the expression editor? Not just pasted it in? Sorry if that part was not clear.

  • DanNZ Profile Picture
    9 on at

    Thanks.  Don't know what I was thinking there!

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

Forum hierarchy changes are complete!

In our never-ending quest to improve we are simplifying the forum hierarchy…

Ajay Kumar Gannamaneni – Community Spotlight

We are honored to recognize Ajay Kumar Gannamaneni as our Community Spotlight for December…

Leaderboard > Power Automate

#1
Michael E. Gernaey Profile Picture

Michael E. Gernaey 522 Super User 2025 Season 2

#2
Tomac Profile Picture

Tomac 364 Moderator

#3
abm abm Profile Picture

abm abm 243 Most Valuable Professional

Last 30 days Overall leaderboard