cancel
Showing results for 
Search instead for 
Did you mean: 
Reply
Masonf2265
Helper II
Helper II

Lookup User Profile and Autopopulate

Hello, 

 

I am trying to create an employee directory through MS Lists and PowerApps > Customized Forms. I have a people picker called "Employee Name" (combo box) where you can type in the employee name which is connected to Office365Users. 

 

I have other columns (text) labeled Department, Job Title, Email Address, Phone Number that I would love to autopopulate based on the record selected in Employee Name combo box (named CB_EmployeeName). 

 

I've tried multiple formulas in the Default property for Department, Job Title, etc.  For instance: 

Office365Users.UserProfileV2(CB_EmployeeName.Selected).Department  

LookUp(Office365Users(CB_EmployeeName.SelectedItems.Department) 

 

Both formulas vomit because CB_EmployeeName is "an Invocation of unknown or unsupported function". 

 

Can anyone please assist? 

 

Thank you!

7 REPLIES 7
CNT
Super User
Super User

@Masonf2265 Try this to get the Department,

Office365Users.SearchUserV2({searchTerm:CB_EmployeeName.SelectedText}).value.Department

Masonf2265
Helper II
Helper II

@CNT 

 

Unfortunately, this does not work. Here is the error I get: 

"Incompatible type. The SearchTerm in the datasource you are updating expects a text type and you are using a record type."

"The function 'SearchUserV2" has some invalid arguments."

RandyHayes
Super User
Super User

@Masonf2265 

The SelectedText property has been deprecated.  Your formula should reference the .Selected.column of the control.

Replace column with the name of the column that contains the value you want.

_____________________________________________________________________________________
Digging it? - Click on the Thumbs Up below. Solved your problem? - Click on Accept as Solution below. Others seeking the same answers will be happy you did.
NOTE: My normal response times will be Mon to Fri from 1 PM to 10 PM UTC (and lots of other times too!)
Check out my PowerApps Videos too! And, follow me on Twitter @RandyHayes

Really want to show your appreciation? Buy Me A Cup Of Coffee!

@RandyHayes 

Office365Users.SearchUserV2({searchTerm:CB_EmployeeName.Selected.Department})

I am still getting errors with this. It says "Expected Text Value"

RandyHayes
Super User
Super User

@Masonf2265 

Yes, that formula by itself, will return a record.

Wherever you are putting this formula is expecting a text value.  

 

However, what you are attempting is not going to work.  You cannot provide a Department name as a search term to the SearchUserV2 action to get people in a Department.

 

Instead you will need to filter the results of the search by the department.  Depending on the size of your organization, this may or may not have accurate results.

_____________________________________________________________________________________
Digging it? - Click on the Thumbs Up below. Solved your problem? - Click on Accept as Solution below. Others seeking the same answers will be happy you did.
NOTE: My normal response times will be Mon to Fri from 1 PM to 10 PM UTC (and lots of other times too!)
Check out my PowerApps Videos too! And, follow me on Twitter @RandyHayes

Really want to show your appreciation? Buy Me A Cup Of Coffee!

@RandyHayes 

 

I was able to figure it out. You were right, the department was too big. 

 

I am now trying to obtain manager name. I want it to provide the manager name and if blank, put "VACANT" in the box instead. Here are some formulas I've tried: 

 

IfError(Office365Users.ManagerV2(CB_EmployeeName.Selected.Text).displayName,"VACANT")

 

If(IfError((Office365Users.ManagerV2(CB_EmployeeName.Selected.Email).displayName),"VACANT",Office365Users.ManagerV2(CB_EmployeeName.Selected.Email).displayName))

 

If(IsBlankOrError(Office365Users.ManagerV2(CB_EmployeeName.Selected.Email).displayName),"VACANT",Office365Users.ManagerV2(CB_EmployeeName.Selected.Email).displayName)

 

The third one works on preview but then provides "Office365.Users.ManagerV2 Failed: The method 'ManagerV2' has an invalid value for parameter 'id' " when i try to add a new entry in my MS List. 

 

Do you know how to resolve this?

@RandyHayes @CNT @WarrenBelz @AJ_Z 

 

Hello, 

 

I am now trying to obtain manager name. I want it to provide the manager name and if blank, put "VACANT" in the box instead. Here are some formulas I've tried: 

 

IfError(Office365Users.ManagerV2(CB_EmployeeName.Selected.Text).displayName,"VACANT")

 

If(IfError((Office365Users.ManagerV2(CB_EmployeeName.Selected.Email).displayName),"VACANT",Office365Users.ManagerV2(CB_EmployeeName.Selected.Email).displayName))

 

If(IsBlankOrError(Office365Users.ManagerV2(CB_EmployeeName.Selected.Email).displayName),"VACANT",Office365Users.ManagerV2(CB_EmployeeName.Selected.Email).displayName)

 

The third one works on preview but then provides "Office365.Users.ManagerV2 Failed: The method 'ManagerV2' has an invalid value for parameter 'id' " when i try to add a new entry in my MS List. 

 

Do you know how to resolve this?

 

Thank you!

Helpful resources

Announcements
PA Virtual Workshop Carousel 768x460.png

Register for a Free Workshop

This training provides practical hands-on experience in creating Power Apps solutions in a full-day of instructor-led App creation workshop.

Microsoft Build 768x460.png

Microsoft Build is May 24-26. Have you registered yet?

Come together to explore latest innovations in code and application development—and gain insights from experts from around the world.

May UG Leader Call Carousel 768x460.png

What difference can a User Group make for you?

At the monthly call, connect with other leaders and find out how community makes your experience even better.

Top Solution Authors
Top Kudoed Authors
Users online (3,197)