Skip to main content

Notifications

Community site session details

Community site session details

Session Id :
Power Automate - Building Flows
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"
}
]
  • DanNZ Profile Picture
    9 on at
    Re: How to extract email addresses from a compose output

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

  • Paulie78 Profile Picture
    8,416 Super User 2025 Season 1 on at
    Re: How to extract email addresses from a compose output

    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
    Re: How to extract email addresses from a compose output

    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.

  • Verified answer
    Paulie78 Profile Picture
    8,416 Super User 2025 Season 1 on at
    Re: How to extract email addresses from a compose output

    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 😘

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

Paul Stork – Community Spotlight

We are honored to recognize Paul Stork as our July 2025 Community…

Congratulations to the June Top 10 Community Leaders!

These are the community rock stars!

Announcing the Engage with the Community forum!

This forum is your space to connect, share, and grow!

Leaderboard > Power Automate

#1
Michael E. Gernaey Profile Picture

Michael E. Gernaey 497 Super User 2025 Season 1

#2
David_MA Profile Picture

David_MA 436 Super User 2025 Season 1

#3
Riyaz_riz11 Profile Picture

Riyaz_riz11 244 Super User 2025 Season 1