The Best Way to Show the Current Logged In User in a Combo Box On a Power Apps Modern Form

I was developing a Power Apps survey form recently, and there, I encountered an issue while displaying the current logged-in user name in a combo box inside the new form. Also, I tried out different formulas to show the logged-in user name by default inside the combo box control, but it didn’t work out anything for me.

Even if the applying formula was correct and the combo box also displayed the current user name, at the same time, while submitting the form, the user name was not saved in the SharePoint list field.

Finally, I found and tried some tricky ways and got the expected result. Also, the username of the current logged-in user is saved correctly in the SharePoint Person column.

In this article, I will tell you how to show the current logged in user in a Combo box on a Power Apps Modern form and save this value in a SharePoint Person field with a simple scenario.

Show the Current Logged In User in a Combo Box On a Power Apps Modern Form

Let me describe the scenario and how to display the current logged-in user in the Power Apps combo box inside the modern new form.

Set up a SharePoint List

I have a SharePoint list named Employee Survey Form that contains the fields below:

ColumnData type
Employee Full NamePerson
Employee EmailSingle line of text
Contact NumberNumber
Current LocationChoice [Australia, Brazil, Canada]
AgeNumber
Show the Current Logged In User in a Combo Box On a Power Apps Form

Add a Power Apps New Form [Modern Control]

In Power Apps, add a Power Apps Modern Form control and connect the specific SharePoint list to the new form.

Show Current Logged In User in a Combo Box On a Power Apps Form

Now, I want to display the current logged-in user’s full name inside the combo box (Employee Full Name) by default when a user opens the app. Also, the user’s full name should be saved in the SharePoint list once we click the Save button.

Wherever the Employee Full Name Combo box’s Items property (by default) is:

Items = Choices([@'Employee Survey Form'].'EmployeeFullName')
Display Current Logged In User in Power Apps Combo Box

Then I tried some of the formulas in Combobox’s DefaultelectedItems property that didn’t meet my requirements, and finally, I found a tricky solution, which I have explained below.

NonWorking Formulas

First, let me tell you all the formulas I have found and tried but did not get proper results.

Formula [Combobox’s DefaultelectedItems Property]ScreenshotDescription
[Parent.Default]Display Current Logged In User Name in Power Apps Combo BoxIt did not display the current logged-in user name, nor was it saved in the SharePoint list.
User().FullNamePower Apps Display Current Loggedin User Name in Combo BoxIt shows an error as “Expected Table Value.”
{Value: User().FullName}Power Apps Display Current Loggedin User in Combo Box and Save in SharePoint listThis code shows an unexpected value in the combo box control even after adding the Display Name from the Edit section (from the Properties pane).
Filter(Distinct(‘Employee Survey Form’, ‘Employee Full Name’.DisplayName), Value = User().FullName)Power Apps Display Current Loggedin User in Combo Box controlThis formula neither shows any current logged-in user name nor gives any error.
Coalesce(Parent.Default, {Claims: “i:0#.f|membership|”&User().Email, Department:””, DisplayName:User().FullName, Email:User().Email, JobTitle:””,Picture””})Show Power Apps current user name in a combo box controlThis code shows the current logged-in user, but it does not save in the SharePoint person field after saving the value.

Apply the Formula on Combobox’s DefaultSelected Property & Update the Datacard

Finally, I achieved this by using the formula below. Also, we need to update the Combo Box data card to save the name in the SharePoint list.

Select the Employee Full Name Combobox control and set its DefaultSelectedItems property as:

{DisplayName:User().FullName}

Next, go to the Properties pane -> Display -> Edit (from Fields) -> + Add field -> Select DisplayName -> Add as shown below.

display current logged in user in power apps combobox

Select the Employee Full Name Data card and set its Update property as: [You can comment on the default code first, like DataCardValue12.Selected]

{Claims:"i:0#.f|membership|" & User().Email,Department:"",DisplayName:"",Email:"",JobTitle:"",Picture:""}
Show the current logged on user in a combo box on a Power Apps new form

Now it’s done.

Submit the Power Apps Form & Save Combobox Value in the SharePoint Person Field

Finally, to save the Power Apps form field values, insert a Power Apps modern button control and set its OnSelect property to the code below:

OnSelect = SubmitForm(SurveyForm); NewForm(SurveyForm); Notify("Your Survey Details Has Been Saved Successfully",NotificationType.Success);

Where,

SurveyForm = Power Apps Edit Form Name

Power Apps Show Current logged in user name in Combo box

Just Save and Publish the application. Preview the form and enter the details except the Employee’s Full name because it will display the current user name by default. Click on the SAVE button.

Power Apps Show Current logged in user name in Combo box on form

Next, we will get a successful notification that our survey details have been saved successfully in the SharePoint list.

Display Power Apps current user name in combobox default

Go to the specific SharePoint list and refresh it. The Power Apps current logged-in user’s full name has been saved in the Person field, as in the screenshot below.

Display Power Apps current user name default in combo box

I hope this article is beneficial to you. This way, we can show the currently logged-in user’s full name by default in the combo box control and store its value in a SharePoint person field.

Also, you may like some more Power Apps articles:

>
Download User registration canvas app

DOWNLOAD USER REGISTRATION POWER APPS CANVAS APP

Download a fully functional Power Apps Canvas App (with Power Automate): User Registration App

Power Platform Tutorial

FREE Power Platform Tutorial PDF

Download 120 Page FREE PDF on Microsoft Power Platform Tutorial. Learn Now…