cancel
Showing results for 
Search instead for 
Did you mean: 
Reply
Ruidiaz
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
v-bacao-msft
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
ManishJain
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

 

v-bacao-msft
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
MPA User Group

Welcome to the User Group Public Preview

Check out new user group experience and if you are a leader please create your group

MSFTBizAppsLaunchEvent

Experience what’s next for Power Virtual Agents

See the latest Power Automate innovations, updates, and demos from the Microsoft Business Applications Launch Event.

New Super Users

Meet the Power Automate Super Users!

Many congratulations to the Season 1 2021 Flownaut Crew!

Power Platform ISV STudio

Power Platform ISV Studio

ISV Studio is the go-to Power Platform destination for ISV’s to monitor & manage applications post-AppSource publish.

Users online (46,869)