cancel
Showing results for 
Search instead for 
Did you mean: 
Reply
Anonymous
Not applicable

How to write a formula to look up user based on job title

Hi,

 

I have a formula to look up a person's email based on their job title:

 

LookUp(
            Office365Users.SearchUserV2({searchTerm: ""}).value,
            JobTitle = "CEO").Mail
);

 

How would you write this to get more information about the user like the User() function where you can append 

 

.Email

.FullName

.Department

 

As needed? My formula is too narrow. I want to get more attributes than just the email.

 

Thanks a lot for your help!

 

Regards,

 

Daniel

1 ACCEPTED SOLUTION

Accepted Solutions
v-qiaqi-msft
Community Support
Community Support

Hi @Anonymous,

Have you solved your problem?

Do you want to get info based on Job Title?

Could you please share a bit more about your need?

Actually, the User() function only support to get info about the current login user.

vqiaqimsft_0-1632280256276.png

If you want to get info like department, Mail based on the Job Title, I think you should use the Office365Users() function.

I think you should pull out all the Job Title using Office365Users() as below:

Distinct(Office365Users.SearchUserV2({searchTerm:""}).value.JobTitle,JobTitle)

vqiaqimsft_1-1632281471974.png

Then you could add a Label and set the Text property to display the needed info based on Job Title:

LookUp(Office365Users.SearchUserV2({searchTerm:""}).value,JobTitle=ComboBox35.Selected.Result).Mail

There is no much easier method as above to achieve this.

Best Regards,
Qi

View solution in original post

2 REPLIES 2
v-qiaqi-msft
Community Support
Community Support

Hi @Anonymous,

Have you solved your problem?

Do you want to get info based on Job Title?

Could you please share a bit more about your need?

Actually, the User() function only support to get info about the current login user.

vqiaqimsft_0-1632280256276.png

If you want to get info like department, Mail based on the Job Title, I think you should use the Office365Users() function.

I think you should pull out all the Job Title using Office365Users() as below:

Distinct(Office365Users.SearchUserV2({searchTerm:""}).value.JobTitle,JobTitle)

vqiaqimsft_1-1632281471974.png

Then you could add a Label and set the Text property to display the needed info based on Job Title:

LookUp(Office365Users.SearchUserV2({searchTerm:""}).value,JobTitle=ComboBox35.Selected.Result).Mail

There is no much easier method as above to achieve this.

Best Regards,
Qi
Anonymous
Not applicable

Hi @v-qiaqi-msft ,

 

My apologies for only replying to you now.

 

Thank you this helps me tremendously.

 

Regards,

 

Daniel

Helpful resources

Announcements
Power Apps News & Annoucements carousel

Power Apps News & Announcements

Keep up to date with current events and community announcements in the Power Apps community.

Community Call Conversations

Introducing the Community Calls Conversations

A great place where you can stay up to date with community calls and interact with the speakers.

Power Apps Community Blog Carousel

Power Apps Community Blog

Check out the latest Community Blog from the community!

Top Solution Authors
Top Kudoed Authors
Users online (4,579)