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

Populate Job Title, Department, etc based on user Full Name

Hi everyone,

 

I've created a form (please reference the attached image).

 

What I'm wanting the form to accomplish is, to enter a user's Full Name and then search for and populate their Email Address, Job Title and Department.

 

Or, to enter their Email Address, and populate their Full Name, Job Title and Department. 

 

I've added the O365 Users Connector and associated it with my form, so I have full access to all its functionality. I'm just not sure the best way to go about achieving this.

 

Thanks in advance!

1 ACCEPTED SOLUTION

Accepted Solutions
seadude
Level 10

Re: Populate Job Title, Department, etc based on user Full Name

Thanks for the screenshots. I'm sorry to make this so long winded. I should have given you a better answer earlier. I've done this in a few apps already but they're on the work computer.

 

I'm certain this will work: 

- For the email field Default Property:

First(Office365Users.SearchUser({searchTerm:name.Text})).Mail

- Change the ".Mail" to ".JobTitle" to for the Job Title field.

 

Good luck!

 

 

View solution in original post

12 REPLIES 12
Super User
Super User

Re: Populate Job Title, Department, etc based on user Full Name

Hi @Anonymous, 

 

Try this: 

- Make the Name column in the list a Sharepoint "Person"-type column

- This will allow you to use Active Directory to lookup the names

- OnVisible/OnStart of your form try:

//Set user email as a variable
Set(varUserEmail,Office365Users.MyProfile().Email)

//Set user job title as a variable
Set(varUserJobTitle,Office365Users.MyProfile().JobTitle)

etc.

- Set the other fields Default property to their respective variable

 

Hope this helps!

Anonymous
Not applicable

Re: Populate Job Title, Department, etc based on user Full Name

Hi @ericonline,

 

Thanks for your response!
 
I went ahead and set the Name column to the "Person/Group" type, which allows me to search and select a user from our AD. Thanks for that suggestion!
 
I'm still not quite sure what to do for the remaining Email Address, Job Title and Department columns. I've attached a screenshot showing the current values for the field. What do I need to input in order to lookup and fill the field, based on the user searched in the Name field?
 
Thanks so much!
Super User
Super User

Re: Populate Job Title, Department, etc based on user Full Name

Hello, 

If you set the variables like I lined out above, you'd then set the Default property shown in your screenshot to `varEmail` and `varJobTitle`, etc.

Anonymous
Not applicable

Re: Populate Job Title, Department, etc based on user Full Name

Okay, I selected the Screen and set the OnStart value to the below:

image.png

 

However now, I am getting this error when setting the Default value of Email Address to varUserEmail:

 

image.png

 

Apologies if I'm making some really basic mistake here. I really appreciate your time and help.

Super User
Super User

Re: Populate Job Title, Department, etc based on user Full Name

Aha. You may try wrapping the variable in the First() function.

 

Can't remember off the top of my head, but try something like First(varUserEmail) or First(varUserEmail).Email or ShowColumns(varUserEmail, Email). 

 

To see whats going on "behind the scenes" and understand this a bit better, slap in a Gallery Control and set its Items Property to varUserEmail. Then play with text boxes in the Gallery to display different columns in the table.

 

Galleries are able to display tabular data where Text Boxes need you to define a Field in the table.

 

Hack around, you'll figure it out 🙂

Anonymous
Not applicable

Re: Populate Job Title, Department, etc based on user Full Name

Sigh, no luck. 🙂 

 

I'm Googling around to try and figure this out, but for whatever the reason, I haven't been able to get it. Can you think of any resource I could reference for help with either the First() function, or variables? 

 

Also, I've tried figuring out how to add a Gallery, but these are the only options I see:

image.png

Anonymous
Not applicable

Re: Populate Job Title, Department, etc based on user Full Name

Okay, some progress!  I have the Name field set up this way:

image.png

 

I have the Department field set up this way:

image.png

 

 

I realize there's an error showing in the form, but even so, when I type in an email address in the Name field, it works:

image.png

 

So, this is definitely progress, but what I'm trying to do, is to be able to enter in someone's Name (not email address) in the Name field, and then be able to populate Job Title, Department, Email address, etc. 

 

Any thoughts on how this might be possible?

 

Thanks again!

 

seadude
Level 10

Re: Populate Job Title, Department, etc based on user Full Name

Thanks for the screenshots. I'm sorry to make this so long winded. I should have given you a better answer earlier. I've done this in a few apps already but they're on the work computer.

 

I'm certain this will work: 

- For the email field Default Property:

First(Office365Users.SearchUser({searchTerm:name.Text})).Mail

- Change the ".Mail" to ".JobTitle" to for the Job Title field.

 

Good luck!

 

 

View solution in original post

Anonymous
Not applicable

Re: Populate Job Title, Department, etc based on user Full Name

Hi @seadude

 

No worries at all! I completely understand. Sorry my response is a bit late, also. It was a busy weekend and I didn't get a chance to try this out until now.

  

Okay, so that did it! Thank you so much for all your help. 🙂 

 

I have a follow-up question that might be a bit of a pain, but... in the case of our organization, we have a certain group of users that, in AD, have their First Name and Last Name populated, but their Email Address follows a slightly different format. For example, most users have FirstName.LastName@Contoso.com, but this specific set of users have FirstName.ABCLastName@Contoso.com.

 

In the form that I just created, when I enter their LastName, FirstName into the Name field, no data returns, since I assume it is searching for something that follows the FirstName.LastName@Contoso.org format. Is there any way that you are aware of that I can have the Name field search off of the LastName, FirstName fields in AD?

 

Please let me know if what I'm saying doesn't make any sense, or if you don't know whether it's possible. Thanks again!

Helpful resources

Announcements
thirdimage

Power Automate Community User Group Member Badge

Fill out a quick form to claim your user group badge now!

sixthImage

Power Platform World Tour

Find out where you can attend!

Power Platform 2019 release wave 2 plan

Power Platform 2019 release wave 2 plan

Features releasing from October 2019 through March 2020

fifthimage

Microsoft Learn

Learn how to build the business apps that you need.

Top Kudoed Authors
Users Online
Currently online: 338 members 6,820 guests
Please welcome our newest community members: