Skip to main content

Notifications

Community site session details

Community site session details

Session Id :
Power Automate - Building Flows
Answered

Search for users, return first business phone or first result

(1) ShareShare
ReportReport
Posted on by 155

Hello!

I try to use the search for users action and I want to get the first business phone of the first result only. I would prefer to avoid getting a for each. I tried a lot of different way to type an expression to get it with no success. I tried other values as well such as Mail with no success either...

Volt26_0-1705955757616.png


I get this error :

Volt26_1-1705955779195.png

 



Can you help me out please?

 

 

  • mickyb23uk Profile Picture
    50 on at
    Search for users, return first business phone or first result
    Would it be possible to get the images fixed on this post?
    I'm having the exact same issue but I can't understand what video you're referencing or the broken screenshot links below.
     
    I'm running this but every row returns N/A when there is a BusinessPhone value present.
     
    if(empty(items('Apply_to_each')?['body/businessPhones']?[0]),'N/A',
        first(items('Apply_to_each')?['body/businessPhones']?[0])
    )
     
     
  • Volt26 Profile Picture
    155 on at
    Re: Search for users, return first business phone or first result

    I'm not done with your video but I found the answer at 2:45

    Here is the formula that returns the first business phone of the first user found :

    outputs('Search_for_users_(V2)')?['body/value']?[0]['BusinessPhones'][0]

     

    Thank you very much!

  • Volt26 Profile Picture
    155 on at
    Re: Search for users, return first business phone or first result

    Thank for the reply. My formula is :
    outputs('Search_for_users_(V2)_2')?['body/value']?['BusinessPhones']

     

    I see a part of yours with a ")" after ['body/value']. Where is the beginning of the parenthesis? I'm looking at your video right now so maybe I will find the answer there but while watching I thought I should ask here just in case. 

  • Verified answer
    creativeopinion Profile Picture
    10,439 Super User 2025 Season 1 on at
    Re: Search for users, return first business phone or first result

    @Volt26 The first() function should be used with the value dynamic content returned from the Search for users (V2) action.

    creativeopinion_0-1705957382942.png

    When you run a test, it'll return the first user.

    creativeopinion_1-1705957408844.png

    From that you can adjust your expression and add:

    ?['BusinessPhones']

     

    creativeopinion_2-1705957488934.png

     

    Run a test.

    creativeopinion_3-1705957500017.png

     

    Take a look a this YT Tutorial I recently uploaded: 3 Mistakes YOU 🫵 are Making with the Apply to Each Action in your Microsoft Power Automate Flow

    In this video tutorial I’ll go over how to avoid these common mistakes when using the Apply to Each action in a Power Automate flow:

    1️⃣ Looping through a Single Item

    2️⃣ Creating Unnecessary Nested Loops

    3️⃣ Looping through an Unfiltered Array

    At the end of the video I share a few helpful insights when it comes to using the Apply to Each action in your flow.

    I'll also cover:

     How to avoid the Apply to Each action with a single item array

     How to use the item() function to access dynamic content in an array

     How to prevent unnecessary nested Apply to Each action loops

     How to use the Select action

     How to convert an array to a string with the Select action

    How to use the Filter Query field

     How to count the number of items in an array

     How to use a condition control

     How to use the concurrency control

     How to set a top count

     How to use Compose actions for troubleshooting

     

    Hope this helps!


    If I helped you solve your problem—please mark my post as a solution .
    Consider giving me a 👍 if you liked my response! If you're feeling generous— ️  Buy me a coffee: https://www.buymeacoffee.com/acreativeopinion

    👉 Watch my tutorials on YouTube
    👉 Tips and Tricks on TikTok

     

Under review

Thank you for your reply! To ensure a great experience for everyone, your content is awaiting approval by our Community Managers. Please check back later.

Helpful resources

Quick Links

Michael Gernaey – Community Spotlight

We are honored to recognize Michael Gernaey as our June 2025 Community…

Congratulations to the May Top 10 Community Leaders!

These are the community rock stars!

Announcing the Engage with the Community forum!

This forum is your space to connect, share, and grow!

Leaderboard > Power Automate

#1
Michael E. Gernaey Profile Picture

Michael E. Gernaey 566 Super User 2025 Season 1

#2
David_MA Profile Picture

David_MA 516 Super User 2025 Season 1

#3
stampcoin Profile Picture

stampcoin 492