cancel
Showing results for 
Search instead for 
Did you mean: 
Reply
New Member

How to loop through array and extract each element

Dear Power Automate community,

I'm a bit stuck with one of my automation... I'm trying to loop through an array and extract each element.

Basically I have a MS Form with an open text response which collects Outlook contacts, and I would like to automate the sending of an email for each contact.

The problem is that the information gathered from MS Forms looks like: DOE John <john.DOE@microsoft.com>; DOET Jane <Jane.DOET@microsoft.com>

So I'm trying to create an array from the string and then use each value to send them an email... however I cannot find how to use each element of the array.

My Flow looks like:
screenshot.59.jpg

 

The split function seems to be working, and it creates the array: split(body('Get_response_details')?['rc4d2b1f0971547c0a40aeb8daf18e5e9'], ';')

The problem comes when I try to use each element of the array to:
1. Find the user in O365 (so I get the full SMTP address)
2. Use the SMTP address found to send an email

Does anyone know how could I do this?

Any help will be much appreciated! 🙂

1 ACCEPTED SOLUTION

Accepted Solutions
Community Support
Community Support

 

Hi @Ruidiaz ,

 

Please try the following configuration:

78.PNG

split(outputs('Compose'),';')
split(split(items('Apply_to_each'),'<')[1],'>')[0]

 

Best Regards,

Community Support Team _ Barry
If this post helps, then please consider Accept it as the solution to help the other members find it more quickly.

View solution in original post

3 REPLIES 3
Solution Sage
Solution Sage

Hi @Ruidiaz ,

 

Using the split function to convert the string to array and then using Apply to Each for array gives me desired output.

 

Capture.JPG

Compose 6 finds indexof '<' and Compose 8 '>'. Compose 7 then retrieves the substring using 

 

substring(items('Apply_to_each_3'),add(outputs('Compose_6'),1),sub(outputs('Compose_8'),add(outputs('Compose_6'),1)))
 
Thanks

 

Community Support
Community Support

 

Hi @Ruidiaz ,

 

Please try the following configuration:

78.PNG

split(outputs('Compose'),';')
split(split(items('Apply_to_each'),'<')[1],'>')[0]

 

Best Regards,

Community Support Team _ Barry
If this post helps, then please consider Accept it as the solution to help the other members find it more quickly.

View solution in original post

This is GREAT!!!

It worked like a charm! Thanks a lot! Much appreciated indeed!

Helpful resources

Announcements
Microsoft Ignite

Microsoft Ignite

Join digitally, March 2–4, 2021 to explore new tech that's ready to implement. Experience the keynote in mixed reality through AltspaceVR!

New Super Users

Meet the Power Automate Super Users!

Many congratulations to the Season 1 2021 Flownaut Crew!

Microsoft Ignite

Microsoft Power Platform: 2021 Release Wave 1 Plan

Power Platform release plan for the 2021 release wave 1 describes all new features releasing from April through September 2021.

MPA Community Blog

Power Automate Community Blog

Check out the community blog page where you can find valuable learning material from community and product team members!

Users online (36,366)