cancel
Showing results for 
Search instead for 
Did you mean: 
Reply
Highlighted
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
Highlighted
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
Highlighted
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

 

Highlighted
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

Highlighted

This is GREAT!!!

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

Helpful resources

Announcements
Community Conference

Power Platform Community Conference

Check out the on demand sessions that are available now!

Power Platform ISV Studio

Power Platform ISV Studio

ISV Studio is designed to become the go-to Power Platform destination for ISV’s to monitor & manage published applications.

Top Solution Authors
Top Kudoed Authors
Users online (13,528)