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
2022 Release Wave 1 760x460.png

2022 Release Wave 1 Plan

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

Community Connections 768x460.jpg

Community & How To Videos

Check out the new Power Platform Community Connections gallery!

User Group Leader Meeting January 768x460.png

Calling all User Group Leaders!

Don't miss the User Group Leader meetings on January, 24th & 25th, 2022.

Users online (1,761)