cancel
Showing results for 
Search instead for 
Did you mean: 
Reply
Viral21
Helper IV
Helper IV

How to find department and manager name for office365 user?

Hello all,

I have 2 dropdown and 2 textbox in my app

 

here is my requirements

 

Dropdown one will populate all Department Name

Based on selected department dropdown two will populate employees name

 

And based on selected employee textbox1 will display it's manager name and textbox2 will display if login user and selected employee have same manger or not.

 

I have above requirement and I am using office365user , before that I have done that with SQl but now I need to use office365user as a database ....so can anyone help me for that?

1 ACCEPTED SOLUTION

Accepted Solutions
v-xiaochen-msft
Community Support
Community Support

Hi @Viral21 ,

 

First dropdown 'Dropdown1' Items: 

Filter(Distinct(ForAll(Office365Users.SearchUserV2().value,ThisRecord.Department),Value),!IsBlank(Result))

// Get all departments

 

Second dropdown 'Dropdown2' Items:

Filter(Office365Users.SearchUserV2().value,Department=Dropdown1.Selected.Result)

// Get all users in a certain department

 

First textinput 'TextInput1' Default:

Office365Users.ManagerV2(Dropdown2.Selected.Id).displayName

// Get manager's displayname

 

Second textinput 'TextInput2' Default:

If( Office365Users.ManagerV2(User().Email).displayName=TextInput1.Text,"same manager","not same manager")

 

Best Regards,
Wearsky
If my post helps, then please consider Accept it as the solution to help others. Thanks.

View solution in original post

13 REPLIES 13
v-xiaochen-msft
Community Support
Community Support

Hi @Viral21 ,

 

How many users do you have?

 

Best Regards,
Wearsky
If my post helps, then please consider Accept it as the solution to help others. Thanks.

@v-xiaochen-msft  We have around 70 to 80 employee maximum

v-xiaochen-msft
Community Support
Community Support

Hi @Viral21 ,

 

First dropdown 'Dropdown1' Items: 

Filter(Distinct(ForAll(Office365Users.SearchUserV2().value,ThisRecord.Department),Value),!IsBlank(Result))

// Get all departments

 

Second dropdown 'Dropdown2' Items:

Filter(Office365Users.SearchUserV2().value,Department=Dropdown1.Selected.Result)

// Get all users in a certain department

 

First textinput 'TextInput1' Default:

Office365Users.ManagerV2(Dropdown2.Selected.Id).displayName

// Get manager's displayname

 

Second textinput 'TextInput2' Default:

If( Office365Users.ManagerV2(User().Email).displayName=TextInput1.Text,"same manager","not same manager")

 

Best Regards,
Wearsky
If my post helps, then please consider Accept it as the solution to help others. Thanks.

Viral21
Helper IV
Helper IV

Hello @v-xiaochen-msft 

Viral21_1-1621407139686.png

Getting this error while put first code for department 

v-xiaochen-msft
Community Support
Community Support

Hi @Viral21 ,

 

This is a warning not an error.

If your dropdown works correctly, please ignore the warning.

 

Best Regards,
Wearsky
If my post helps, then please consider Accept it as the solution to help others. Thanks.

 

Viral21
Helper IV
Helper IV

Hello @v-xiaochen-msft

Viral21_0-1621408817096.png

For Employee dropdown I got error. I also tried like DWEmpName.Selectedtext.value but still not working


 

v-xiaochen-msft
Community Support
Community Support

Hi @Viral21 ,

 

It's weird. It works for me.

There is a trick you can try. Add a "." or a "," after each word.

v-xiaochen-msft_0-1621409678828.png

v-xiaochen-msft_1-1621409703537.png

The formula will prompt you which property you can use.

 

Best Regards,
Wearsky
If my post helps, then please consider Accept it as the solution to help others. Thanks.

Viral21
Helper IV
Helper IV

@v-xiaochen-msft 
After "." it not shown anything in my case.

while I entered "," it shown this record

Viral21_0-1621410526511.png

So what I need to now?

v-xiaochen-msft
Community Support
Community Support

Hi @Viral21 ,

 

So it may be caused by the region.

Please try this formula:

Filter(Distinct(ForAll(Office365Users.SearchUserV2(),ThisRecord.Department),Value),!IsBlank(Result))
Filter(Office365Users.SearchUserV2(),Department=Dropdown1.Selected.Result)

 

Best Regards,
Wearsky
If my post helps, then please consider Accept it as the solution to help others. Thanks.

Helpful resources

Announcements
Power Platform Conf 2022 768x460.jpg

Join us for Microsoft Power Platform Conference

The first Microsoft-sponsored Power Platform Conference is coming in September. 100+ speakers, 150+ sessions, and what's new and next for Power Platform.

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.

PA.JPG

New Release Planning Portal (Preview)

Check out our new release planning portal, an interactive way to plan and prepare for upcoming features in Power Platform.

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