web
You’re offline. This is a read only version of the page.
close
Skip to main content

Notifications

Announcements

Community site session details

Community site session details

Session Id :
Power Platform Community / Forums / Power Apps / Populate Job Title, De...
Power Apps
Unanswered

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

(0) ShareShare
ReportReport
Posted on by

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!

Categories:
I have the same question (0)
  • Community Power Platform Member Profile Picture
    on at

    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!

  • Community Power Platform Member Profile Picture
    on at

    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!
  • Community Power Platform Member Profile Picture
    on at

    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.

  • Community Power Platform Member Profile Picture
    on at

    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.

  • Community Power Platform Member Profile Picture
    on at

    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 🙂

  • Community Power Platform Member Profile Picture
    on at

    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

  • Community Power Platform Member Profile Picture
    on at

    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!

     

  • Verified answer
    seadude Profile Picture
    1,855 on at

    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!

     

     

  • Community Power Platform Member Profile Picture
    on at

    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!

  • Community Power Platform Member Profile Picture
    on at

    Awesome. If you wouldn't mind marking my last post as the solution, that will help others with similar questions find the answer too :). 

     

    RE: Names in AD in different orders: That is indeed tricky! 

    - Hm.... I think you can try wrapping your search query with the `in` or `exactin` function

    - This should allow searching for "Smith" to find "Smith, Betsy" and "Betsy Smith". 

    - I'm not exactly sure how. You'll have to do some research there. 

Under review

Thank you for your reply! To ensure a great experience for everyone, your content is awaiting approval by our Community Managers. Please check back later.

Helpful resources

Quick Links

Forum hierarchy changes are complete!

In our never-ending quest to improve we are simplifying the forum hierarchy…

Ajay Kumar Gannamaneni – Community Spotlight

We are honored to recognize Ajay Kumar Gannamaneni as our Community Spotlight for December…

Leaderboard > Power Apps

#1
WarrenBelz Profile Picture

WarrenBelz 796 Most Valuable Professional

#2
Michael E. Gernaey Profile Picture

Michael E. Gernaey 327 Super User 2025 Season 2

#3
Power Platform 1919 Profile Picture

Power Platform 1919 268

Last 30 days Overall leaderboard