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
Solution Sage
Solution Sage

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
Super User

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
Solution Sage
Solution Sage

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...

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

Helpful resources

Announcements
Power Platform Conf 2022 768x460.jpg

Join us for Microsoft Power Platform Conference

The first Microsoft-sponsored Power Platform Conference is coming in September. 100+ speakers, 150+ sessions, and what's new and next for Power Platform.

New Ideas Forum MPA.jpg

A new place to submit your Ideas for Power Automate

Announcing a new way to share your feedback with the Power Automate Team.

MPA Virtual Workshop Carousel 768x460.png

Register for a Free Workshop

Learn to digitize and optimize business processes and connect all your applications to share data in real time.

MPA Licensing.jpg

Ask your licensing questions at the Power Automate AMA!

Join Priya Kodukula and the licensing team, super users and MVPs to find answers to your questions on Power Automate licensing.

Users online (1,952)