Introduction
Most of the time there will be a requirement to auto-populate logged-in user names either in a single line of text column or a person or group column. This article has solutions for both :)
Step 1
Below is my list of employees with the column Emp Name which is a Single line of text and the Employee Name column which is Person or Group.
Step 2
Create a Customized form.
Step 3
Select the DataCard and unlock it as below to add the formulas.
Step 4
Connect the Office 365 Users Data source to the app.
Step 5
Select the input field of Emp Name (single line of text) and add the formula to the Default property
Office365.Users.UserProfile(User().Email).DisplayName or User().FullName
User() - Returns the detailed information of current user
User().Email - Returns the email address of current user
User().Fullname - Returns the full name of current user
Step 6
Select the input field of Employee Name (person or group) and add the formula to DefaultSelectedItems
Office365Users.SearchUser({searchTerm:User().Email})
Syntax
Office365Users.SearchUser([Optional] string searchterm, [advanced] [Optional] integer top)
Name |
Type |
Summary |
Required |
searchTerm |
string(Search term) |
Search string (applies to display name, given name, surname, mail, mail nickname, and user principal name). |
False |
top |
integer(int32)(Top) |
Limit on the number of results to return. By default returns all entries. |
False |
Refer to the link for syntax: http://www.carlosag.net/PowerApps/Connectors/Office-365-Users
Summary
In this article, we have learned to auto-populate the currently logged-in user name in a single line of text column and person or group column.