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

Announcements

News and Announcements icon
Community site session details

Community site session details

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

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

Introducing the 2026 Season 1 community Super Users

Congratulations to our 2026 Super Users!

Kudos to our 2025 Community Spotlight Honorees

Congratulations to our 2025 community superstars!

Congratulations to the March Top 10 Community Leaders!

These are the community rock stars!

Leaderboard > Power Automate

#1
Haque Profile Picture

Haque 605

#2
Valantis Profile Picture

Valantis 340

#3
11manish Profile Picture

11manish 284

Last 30 days Overall leaderboard