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 / How do I capture, stor...
Power Apps
Suggested Answer

How do I capture, store and display the name of a user who submitted an item?

(2) ShareShare
ReportReport
Posted on by 330
On my form, I have a Single line of text datacard that I want to use to capture the name of the user who is making a choice on the form. I have a dropdown datacard with the choices that need to be made. When the user first loads the form, I want my text field that will hold the user's name to be blank, Once they select their choice from the drop down, I want their name captured at that point in my single line of text datacard. How do I achieve this?
So far, I have variable defined in my OnStart of the app
set(varMyUser, {})
The default property of my single line of text datacard is
If(
 myForm.Mode = FormMode.New
 User().Fullname,
 ThisItem.'My Text Column'
)
And the OnChange of my dropdown
UpdateContext({varMyUser: 
 {
  Claims: "i:0#.f|membership|" &Lower(User().Email), 
  DisplayName: User().FullName, 
  Email: User().Email
 }
} 
 
)
 
With my setup, the single line of text is always showing the name of the logged in user. So after an entry has been submitted, when another user goes in to view the item, the new user's name is being displayed...not the user who submitted the item. How do I get this to always display the name of the user who submitted the item?
Categories:
I have the same question (0)
  • Suggested answer
    Haque Profile Picture
    3,653 on at
    Hi @Spawn10,
     
    Your approach was "kind of right" but it seems capturing user who is making the choice and retrieving them need to store the captured user name properly for the submitter name. I am rephrasing the core requirement and let's attack with step by step solution:
     
    The Requirement:
    Initially, the user name field should be blank. When the user selects from the dropdown, their name should be captured and saved. Later, when viewing the record, the user name field should show the name of the user who submitted the entry, not the current logged-in user. 
     
    The Steps to solve:
     
    1. Form's OnVisible property or screen's OnVisible property, initialize a context variable to blank:
    2. On Dropdown Selection, capture user name: OnChange property, set the context variable to the current user's full name:
    UpdateContext({ varMyUser: User().FullName })
    3. Set the Default Property of Data Card- In the single line of text input control inside the DataCard for user name, set the Default property to:
     
    Note: Replace 'UserName' with the actual name of your Dataverse column that stores the user name.
     
    4. Set the Update Property of the Username DataCard - In the DataCard for the user name field, set the Update property to the Text input control's Text property, e.g., DataCardValueUserName.Text //--This will ensure when the forms reloads ThisItem.UserName will fill the datacard.
    5. Submit the Form - When the form is submitted, the user name captured in varMyUser will be saved to the Dataverse column.
     
    The issue you're facing happens probably because your text field's Default property or variable is always showing the current logged-in user, rather than the user who originally submitted the record.
     
    If it helps, like and mark as a solution.
     

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 Launch!

Jump in, show your community spirit, and win prizes!

Kudos to our 2025 Community Spotlight Honorees

Expanding mentorship, skilling, and AI innovation

Congratulations to the May Top 10 Community Leaders!

These are the community rock stars!

Leaderboard > Power Apps

#1
Valantis Profile Picture

Valantis 424

#2
WarrenBelz Profile Picture

WarrenBelz 355 Most Valuable Professional

#3
11manish Profile Picture

11manish 290

Last 30 days Overall leaderboard