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

Community site session details

Session Id : Uv7xlSwfAtKNYCAz1aLCFJ
Power Automate - Building Flows
Answered

How to extract email addresses from a compose output

Like (0) ShareShare
ReportReport
Posted on 25 May 2021 04:40:13 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"
}
]
I have the same question (0)
  • DanNZ Profile Picture
    9 on 26 May 2021 at 20:21:46
    Re: How to extract email addresses from a compose output

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

  • Paulie78 Profile Picture
    8,416 Moderator on 26 May 2021 at 10:40:51
    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 25 May 2021 at 21:47:19
    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 Moderator on 25 May 2021 at 05:11:03
    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

Responsible AI policies

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

Telen Wang – Community Spotlight

We are honored to recognize Telen Wang as our August 2025 Community…

Congratulations to the July Top 10 Community Leaders!

These are the community rock stars!

Leaderboard > Power Automate

#1
Tomac Profile Picture

Tomac 986 Moderator

#2
stampcoin Profile Picture

stampcoin 699 Super User 2025 Season 2

#3
Riyaz_riz11 Profile Picture

Riyaz_riz11 577 Super User 2025 Season 2