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!
@Masonf2265 Try this to get the Department,
Office365Users.SearchUserV2({searchTerm:CB_EmployeeName.SelectedText}).value.Department
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."
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.
Office365Users.SearchUserV2({searchTerm:CB_EmployeeName.Selected.Department})
I am still getting errors with this. It says "Expected Text Value"
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.
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!