web
You’re offline. This is a read only version of the page.
close
Skip to main content
Community site session details

Community site session details

Session Id :
Power Automate - Building Flows
Answered

Action Search For Users (V2) pulls multiple IDs

(0) ShareShare
ReportReport
Posted on by 8

Hello! I created a flow that sends an email after a form has been submitted. The flow uses Search For Users (V2) to search for a name provided in the form, then Get User Profile (V2) retrieves their email. The flow has successfully been run by multiple people; however today it pulled two ids for two people with the same name. Because of this, the following action couldn't retrieve the email and the flow failed, stating the id was null. Is there a way to designate which user to use in this case? I included a screenshot of the Search For Users (V2) output. In this scenario we would want to have the first ID, though I'm not sure if that will be the case every time, or if this will happen with additional users as well. 

 

Cinged_1-1631057385390.png

 


Thank you for any help you can provide!!

I have the same question (0)
  • v-bofeng-msft Profile Picture
    on at
    Re: Action Search For Users (V2) pulls multiple IDs

    Hi @Cinged :

    Do you want to get the first user's id from the 'Search for users' action?

    If so,I've made a test for your reference:

    vbofengmsft_0-1631069319378.png

    Expression:

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

    Best Regards,

    Bof

  • Cinged Profile Picture
    8 on at
    Re: Action Search For Users (V2) pulls multiple IDs

    Thank you for the response!

    In the screenshot I want the first id, however I don't know if we'll want the first id every time the flow triggers two ids. It depends on whether this particular user is always the first id, and whether there are other users that will also trigger two ids. 

  • Cinged Profile Picture
    8 on at
    Re: Action Search For Users (V2) pulls multiple IDs

    @v-bofeng-msft 

    When creating the Compose action, I get an error "Correct to include a valid reference to 'Search_for_users_(V2)' for the input parameter(s) of action 'Compose'". 

     

    Would it theoretically be possible to use that same function and search by other criteria? Instead of searching for item 0 in id, maybe search for company or other value? I tried playing with changing those values, however I get the same error as before. 

  • Cinged Profile Picture
    8 on at
    Re: Action Search For Users (V2) pulls multiple IDs

    I figured out that error; I had renamed the action, so I just had to enter the new action name correctly. With playing around with the values, though, it seems an integer is required in the compose action, so I can't seem to tell it "look at a certain criteria and pull the one with string 'xyz'". Is there another workaround for this, so that these emails aren't set to the wrong user email? 

     

    Thank you again for your help!

     

  • Verified answer
    v-bofeng-msft Profile Picture
    on at
    Re: Action Search For Users (V2) pulls multiple IDs

    Hi @Cinged :

    Please try:

    vbofengmsft_0-1631150129922.png

    Best Regards,

    Bof

  • ChadVKealey Profile Picture
    1,393 on at
    Re: Action Search For Users (V2) pulls multiple IDs

    We had this problem with a number of users who had secondary/service accounts with the same email address. Whenever possible, you want to search for/match User Principle Name, which is required to be unique (email is not). 

  • Cinged Profile Picture
    8 on at
    Re: Action Search For Users (V2) pulls multiple IDs

    Thank you everyone for your replies; I've been out of office due to emergency. We ended up using agent IDs rather than name to pull the email, which is similar to @ChadVKealey's suggestion and it worked like a charm.

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

Responsible AI policies

As AI tools become more common, we’re introducing a Responsible AI Use…

Chiara Carbone – Community Spotlight

We are honored to recognize Chiara Carbone as our Community Spotlight for November…

Leaderboard > Power Automate

#1
Michael E. Gernaey Profile Picture

Michael E. Gernaey 614 Super User 2025 Season 2

#2
Tomac Profile Picture

Tomac 401 Moderator

#3
chiaraalina Profile Picture

chiaraalina 282

Last 30 days Overall leaderboard