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

Announcements

News and Announcements icon
Community site session details

Community site session details

Session Id :
Power Platform Community / Forums / Power Apps / Filter person column b...
Power Apps
Unanswered

Filter person column by Jobtitle

(0) ShareShare
ReportReport
Posted on by 593

Hi All

 

I am using combobox to filter person or group column by Job Title. I have around 3500 users in my AD, however the below piece of code only searches through 999 entries in AD. May i know how to search across all 3500 users in AD?

 

Filter(Office365Users.SearchUser({searchTerm:"",top:999}), "Manager" in JobTitle||"Associate" in JobTitle||"Director" in JobTitle||"Accountant" in JobTitle)

 

Categories:
I have the same question (0)
  • ANB Profile Picture
    7,250 Super User 2026 Season 1 on at

    HI @Iantaylor2050, It not that it will search only 999 entries in Office 365 users, it will search all users based on Search Text you have added and returns you top 999 entries. Example: If you search lets say A, so your searchTerm will search against the column that you have mentioned in SearchFields property of combo box. In my case it will search against DisplayName column for all entries of Office 365 users and give top 999 results. If the search matching gives you lets say 1500, still it will return top 999 entries.

    ANB_0-1704222117435.png

    Also do not use Office365Users.SearchUser because it is deprecated https://learn.microsoft.com/en-us/connectors/office365users/#search-for-users-[deprecated]

     

    Instead use Office365Users.SearchUserV2 https://learn.microsoft.com/en-us/connectors/office365users/#search-for-users-(v2)

     

    -----------------------------------------------------------------------------------------------------------------------------

    I hope this helps.

    Please click Accept as solution ✅ if my post helped you solve your issue. This will help others find it more readily. It also closes the item. If the content was useful in other ways, please consider giving it Thumbs up.👍

    Thanks,
    ANB


     

  • Iantaylor2050 Profile Picture
    593 on at

    Hi @WarrenBelz 

     

    I have tried using SearchUserV2 as well for above. However it doesnt return any records with above JobTitle.

     

    Filter(
     Office365Users.SearchUserV2({top:3000}).value,
     StartsWith(JobTitle, "Manager"))

     

     

    May i know where i am going wrong? 

  • WarrenBelz Profile Picture
    154,759 Most Valuable Professional on at

    @Iantaylor2050 ,

    This should work

    Filter(
     Office365Users.SearchUser({top:999}),
     StartsWith(
     JobTitle,
     "Manager"
     )
    )

    or if you want to use V2

    Filter(
     Office365Users.SearchUserV2(
     {
     searchTerm: Self.SearchText,
     top: 999
     }
     ).value,
     StartsWith(
     JobTitle,
     "Manager"
     )
    )

     

    Please click Accept as solution if my post helped you solve your issue. This will help others find it more readily. It also closes the item. If the content was useful in other ways, please consider giving it Thumbs Up.

    MVP (Business Applications)   Visit my blog Practical Power Apps

  • Iantaylor2050 Profile Picture
    593 on at

    Hi @WarrenBelz 

     

    Yes, this works only for 999 profiles. I have 3500 profiles to be queried. Hence the SearchUser function doesnt work here and i m trying with SearchUserV2

  • WarrenBelz Profile Picture
    154,759 Most Valuable Professional on at

    HI @Iantaylor2050 ,

    999 is the maximum for V2 as well. Bear in mind you can search by the control itself with the code I provided to narrow the matches down to this (999 is the maximum it can return)

  • Iantaylor2050 Profile Picture
    593 on at

    Hi @WarrenBelz 

     

    It still doesnt show all the users from AD with below job title. It only shows till 999. 

     

    "Manager" in JobTitle||"Associate" in JobTitle||"Director" in JobTitle||"Accountant" in JobTitle
  • WarrenBelz Profile Picture
    154,759 Most Valuable Professional on at

    Hi @Iantaylor2050 ,

    Did you try the V1 code I provided to see if that works. 

  • Iantaylor2050 Profile Picture
    593 on at

    Hi @WarrenBelz 

     

    Yes i did try. However the code doesnt work. Any alternative options available to query all 3500 user profiles?

  • mmbr1606 Profile Picture
    14,615 Super User 2026 Season 1 on at

    hey @Iantaylor2050 

     

    can u try this?

     

    // When the button is clicked
    Clear(colAllUsers); // Clear the existing collection
    Set(varPageNumber, 1); // Initialize the page number
    Set(varHasMore, true); // Initialize the control variable
    
    // Start the process
    Collect(colAllUsers, Office365Users.SearchUser({searchTerm:"", top:999}));
    Set(varPageNumber, varPageNumber + 1);
    
    // Use this in a button or other control to continue fetching users
    If(
     varHasMore,
     Collect(
     colAllUsers, 
     Office365Users.SearchUser({searchTerm:"", top:999, skip: (varPageNumber - 1) * 999})
     );
     // Check if less than 999 users were returned, indicating the end of the data
     If(
     CountRows(Last(colAllUsers)) < 999, 
     Set(varHasMore, false)
     );
     Set(varPageNumber, varPageNumber + 1)
    );
    
    // After all data is fetched, you can filter the users as needed
    colFilteredUsers = Filter(
     colAllUsers, 
     "Manager" in JobTitle || "Associate" in JobTitle || "Director" in JobTitle || "Accountant" in JobTitle
    );

     

    Let me know if my answer helped solving your issue.

    If it did please accept as solution and give it a thumbs up so we can help others in the community.



    Greetings

  • WarrenBelz Profile Picture
    154,759 Most Valuable Professional on at

    Hi @Iantaylor2050 ,

    No - not as far as I am aware - using the inbuilt search may help

    Filter(
     Office365Users.SearchUser(
     {
     searchTerm: Self.SearchText,
     top:999
     }
     ),
     StartsWith(
     JobTitle,
     "Manager"
     )
    )

     

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

Introducing the 2026 Season 1 community Super Users

Congratulations to our 2026 Super Users!

Kudos to our 2025 Community Spotlight Honorees

Congratulations to our 2025 community superstars!

Leaderboard > Power Apps

#1
WarrenBelz Profile Picture

WarrenBelz 493 Most Valuable Professional

#2
11manish Profile Picture

11manish 479

#3
Haque Profile Picture

Haque 328

Last 30 days Overall leaderboard