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

Announcements

News and Announcements icon
Community site session details

Community site session details

Session Id :
Power Platform Community / Forums / Power Apps / Referencing a user in ...
Power Apps
Unanswered

Referencing a user in a Collection - trying to populate value

(0) ShareShare
ReportReport
Posted on by 143

Hello,

 

I am trying to populate a user field 'Employee Name' in a Collection. I have a defined variable that captures the user, this is varUser.

There are 3 ways I have seen this done in videos and templates:
Method 1:

Tj7933_0-1671737389975.png

Method 2:

Tj7933_1-1671737406261.png

 

Method 3:

Tj7933_2-1671737486015.png

 

I have tried all three of these methods and the collection will not accept the values.  What am I doing wrong? Below is the code that has been acceptable to the app.  .

Tj7933_3-1671737539397.png

As soon as the 'Employee Name' field is added, the app throws an error.  It is doing this also for all the comboboxes and drop-downs, but I want to go one step at a time.

Someone please explain how comboboxes, dropdowns and people are su

 

 



Categories:
I have the same question (0)
  • WarrenBelz Profile Picture
    156,409 Most Valuable Professional on at

    @Tj7933 

    Firstly, please post code in Text - the below is OCR'd, so watch spelling etc. Assuming currentUser is a Variable of Person type, are you saying the below does not work ?

    Patch(
     colTimesheetDetails, 
     {ID: ThisItem.ID},
     {
     'START - Date': dpStartDate.SelectedDate,
     'END - Date': dpEndDate.SelectedDate,
     'Start Hour': Value(txtStartHour.Text),
     'End Hour': Value(txtEndHour.Text),
     'Non-Event Related Work Hours': Value(txtNRHours.Text), 
     'Lunch Break': ckbLunch.Value,
     'Travel Status': ckbTravel.Value,
     'Lunch Delivered': ckbDeLiver.Value,
     'Additional Information': txtDetaiLs.Text,
     '699 - Day Off': ckb699.Value,
     Employee: 
     {
     '@odata.type': "#Microsoft.Azure.Connectors.SharePoint.SPListExpandedUser", 
     Claims: "i:0#.f|membership|" & Lower(currentUser.Email),
     Department: "",
     DisplayName: currentUser.FullName,
     Email: currentUser.Email,
     JobTitle: "",
     Picture: ""
     }
     }
    )

     

    Please click Accept as solution if my post helped you solve your issue. This will help others find it more readily. It also closes the item. If the content was useful in other ways, please consider giving it Thumbs Up.

    MVP (Business Applications)   Visit my blog Practical Power Apps

  • Tj7933 Profile Picture
    143 on at

    Sorry about the wrong posting methodology.

    Everything now has the red underline. 

    I tried it with varUser (my defined user variable) and CurrentUser (the wording in your clip.  It still will not work.


    "Invalid Argument type.  Expecting a Record Value, but of a different schema.

    Missing column. Your formula is missing a column 'Claims" with a type of 'Text'.
    The function 'Patch' has some invalid arguments."

  • Tj7933 Profile Picture
    143 on at

    This is how the collection is set up.  If I change any aspect of the 'Employee Name' the collection throws an error as well.

    //Define Data
    Collect(colTimesheetDetails,{
     'Employee Name': VarUser,
     Week_End_Date: DateValue(lblEndDate.Text),
     WeekEndNum: Text(DateValue(lblEndDate.Text),"yyyymmdd"),
     DayOfWeek: DateValue(lblEndDate.Text)-7,
     'START - Date': dpStartDate.SelectedDate,
     'END - Date': dpEndDate.SelectedDate,
     DayOfWeekNum: Text(dpStartDate.SelectedDate,"yyyymmdd"),
     'Start Hour':0,
     'End Hour':0,
     'Start - Minutes': {Value:"00"},
     'End - Minutes': {Value:"00"},
     'Non-Event Related Work Hours': 0,
     'Approval Status': {Value:"In Progress"},
     'Lunch Break': true,
     'Travel Status': false,
     'Lunch Delivered': false,
     '699 - Day Off': false,
     'Additional Information': Blank(),
     EntryType: {Value:"Timesheet"}
    });
  • Tj7933 Profile Picture
    143 on at

    I created a new Person Picker field in the list.  Then applied everything that has been suggested.  The results were:

    "Invalid Argument type.  Expecting a Record Value, but of a different schema.

    Missing column. Your formula is missing a column 'DisplayName" with a type of 'Text'.
    The function 'Patch' has some invalid arguments."

     

  • WarrenBelz Profile Picture
    156,409 Most Valuable Professional on at

    @Tj7933 ,

    Assuming Employee is a Person field and currentUser is a Variable reflecting the User() , function then this is the correct syntax for posting to it

    Employee: 
    {
     '@odata.type': "#Microsoft.Azure.Connectors.SharePoint.SPListExpandedUser", 
     Claims: "i:0#.f|membership|" & Lower(currentUser.Email),
     Department: "",
     DisplayName: currentUser.FullName,
     Email: currentUser.Email,
     JobTitle: "",
     Picture: ""
    }

    to bypass the currentUser part, you might test with this

    Employee: 
    {
     '@odata.type': "#Microsoft.Azure.Connectors.SharePoint.SPListExpandedUser", 
     Claims: "i:0#.f|membership|" & Lower(User().Email),
     Department: "",
     DisplayName: User().FullName,
     Email: User().Email,
     JobTitle: "",
     Picture: ""
    }

     

    Please click Accept as solution if my post helped you solve your issue. This will help others find it more readily. It also closes the item. If the content was useful in other ways, please consider giving it Thumbs Up.

    MVP (Business Applications)   Visit my blog Practical Power Apps

     

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

Season of Sharing Community Challenge Winners!

Congratulations to our community stars!

Kudos to our 2025 Community Spotlight Honorees

Expanding mentorship, skilling, and AI innovation

Congratulations to the July Top 10 Community Leaders!

These are the community rock stars!

Leaderboard > Power Apps

#1
WarrenBelz Profile Picture

WarrenBelz 358 Most Valuable Professional

#2
11manish Profile Picture

11manish 207 Super User 2026 Season 2

#3
MS.Ragavendar Profile Picture

MS.Ragavendar 150 Super User 2026 Season 2

Last 30 days Overall leaderboard