In this article, I want to discuss one of the repeating issues in the community, how to implement a JOIN while retrieving the manager details in a loop in Power Apps.
Business case:
User wants to implement a gallery with all the details of the user with their manager name as part of the results set.
Technical Challenge:
To get the manager name of the user we will need to perform the below query:
Office365Users.ManagerV2(User().Email).mailBut if we need to the manager email in a loop will be an expensive call as the app need to perform that many AD calls.
ClearCollect( collUserProfile, AddColumns( Office365Users.SearchUser({txtEmail.Text}), "ManagerEmail", If( IsError(Office365Users.ManagerV2(Id).mail), Blank(), Office365Users.ManagerV2(Id).mail ) ) );In the above query txtEmail.Text will hold the text provided by the user, so if the user provides the full email it will give only one recordset into the collection, if the user-provided partial text of first name or last name the result will be more than one record.
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.