cancel
Showing results for 
Search instead for 
Did you mean: 
Reply
cadone
Helper V
Helper V

Remove apply for each

Hi,

The flow gives me apply to each for the user name. i know its only 1 person with that username. How to remove that unwanted apply to each?

cadone_0-1605618542589.png

 

1 ACCEPTED SOLUTION

Accepted Solutions
Jay-Encodian
Community Champion
Community Champion

Hi @cadone 

The return data type is an array, even if an array only contains one item it's still an array and therefor when you use the dynamic data it will always add an 'Apply to each' loop

You need to use the first() expression to stop the 'Apply to each' loop from being created , for example:

1.jpg

Expression:

first(outputs('Search_for_users_(V2)')?['body/value'])?['DisplayName']

To obtain a different value you need to change the 'DisplayName' for your desired property:

2.jpg

HTH

Jay

View solution in original post

1 REPLY 1
Jay-Encodian
Community Champion
Community Champion

Hi @cadone 

The return data type is an array, even if an array only contains one item it's still an array and therefor when you use the dynamic data it will always add an 'Apply to each' loop

You need to use the first() expression to stop the 'Apply to each' loop from being created , for example:

1.jpg

Expression:

first(outputs('Search_for_users_(V2)')?['body/value'])?['DisplayName']

To obtain a different value you need to change the 'DisplayName' for your desired property:

2.jpg

HTH

Jay

View solution in original post

Helpful resources

Announcements
UG GA Amplification 768x460.png

Launching new user group features

Learn how to create your own user groups today!

Community Connections 768x460.jpg

Community & How To Videos

Check out the new Power Platform Community Connections gallery!

M365 768x460.jpg

Microsoft 365 Collaboration Conference | December 7–9, 2021

Join us, in-person, December 7–9 in Las Vegas, for the largest gathering of the Microsoft community in the world.

Users online (1,864)