cancel
Showing results for 
Search instead for 
Did you mean: 
Reply
DavidDostal
Helper I
Helper I

Test if user found

Dear all,

thanks in advance for an advice to the Power newbie from any of you.

 

I am trying to find user's UPN upon providing his/her DisplayName and create a Planner task assigned to him/her when found. I use 'Office 365 users' and its 'Search for Users (V2}' action. It works perfectly, when user is found. I want to include search result check to the flow and apply another flow steps when he/her not found. How to do that, please? How should I test if 'value' returned from Search for Users is null or not?

 

Many thanks in advance, even for solution proposal of this particular task or for giving me link to another source.

 

Regards,

David 

1 ACCEPTED SOLUTION

Accepted Solutions
sudharsan1985
Super User
Super User

Hi David,

 

You can try using the Condition branch and check for the length of the value returned from the 'Search for users (V2)'  and use the Yes and No outcome branch to proceed with your flow.

 

Try to use 'length(body('Search_for_users_(V2)')?['value'])' for the condition branch value shown below.

 

Flow Res 1.png

 

I hope you find useful. Please try it out and mark it as a solution if it worked.

 

Regards

Sudharsan K...

Hope it helps, please like it or mark it as a solution if it resolves your clarification or issue
-Sudharsan K...

View solution in original post

3 REPLIES 3
efialttes
Super User III
Super User III

Hola David!
"How should I test if 'value' returned from Search for Users is null or not?"
I think there is an easy way to test it. Just create a dummy flow (manually executed", then add an action block "Search for users v2" and add as its input a dummy text. Execute it and inspect its results
Animo!


Each time you click on any of our inspiring answers 'Thumb up' icon...
...an ewok scapes from the stormtroopers.

Be grateful, Thumbs up! Save the Galaxy for free!


Escribo sobre Power Automate en:
https://medium.com/anyone-can-automate/

Proud to be a Flownaut!



sudharsan1985
Super User
Super User

Hi David,

 

You can try using the Condition branch and check for the length of the value returned from the 'Search for users (V2)'  and use the Yes and No outcome branch to proceed with your flow.

 

Try to use 'length(body('Search_for_users_(V2)')?['value'])' for the condition branch value shown below.

 

Flow Res 1.png

 

I hope you find useful. Please try it out and mark it as a solution if it worked.

 

Regards

Sudharsan K...

Hope it helps, please like it or mark it as a solution if it resolves your clarification or issue
-Sudharsan K...

View solution in original post

Many thanks. My concept was right (same as yours) my fault was convention of the condition. Works perfectly. Thanks.

Helpful resources

Announcements
MBAS Attendee Badge

Claim Your Badge & Digital Swag!

Check out how to claim yours today!

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

secondImage

Are Your Ready?

Test your skills now with the Cloud Skill Challenge.

Top Solution Authors
Users online (72,289)