Forum Discussion
How to copy the user name to a field of Sharepoint list who creates the item of this list
In a SharePoint list with fields Emp-name (text type), Start-Date, End-Date, and Description (text type), I would like to automatically set the default value of the Emp-name field to the user's email address when they add a new item to the list.
For example:
- User 1 ('email address removed for privacy reasons') adds an item with Start-Date = Jan 1, End-Date = Jan 14, and Description = 'Worked on the first page of the app.'
- User 2 ('email address removed for privacy reasons') adds an item with Start-Date = Jan 6, End-Date = Jan 20, and Description = 'Troubleshooted the app.'
Upon entering the item, the Emp-name field should automatically populate with the respective user's email address, creating a record like this:
Emp-name Start-Date End-Date Description
mailto:email address removed for privacy reasons jan1 jan 14 workded on the first page of the app
mailto:email address removed for privacy reasons jan6 jan 20 troubleshooted the app
Thank you!
Djeanthi
- ganeshsanapJan 30, 2024MVP
Djeanthi2215 SharePoint provides the Created By column in the list by default which shows the name of person who created the list item, you can add it to list view like:
Check detailed steps to add the column to list view at: Show or hide columns in the SharePoint list
If you don't want to use the SharePoint default created by column and still want to auto-populate the text field so that it can be edited later by someone else, you have below options:
- Power Apps: Customize the SharePoint list forms using Power Apps and auto populate the text field based on currently logged in user. You can get the currently logged in user details using User() function in Power Apps. Check:
- Power Automate: Create a Power automate flow which will run when new item is created and use "Update item" action in Power automate flow to update the text field based on Created By Display name from dynamic content. Note: It will take some time to update the list view with the user name (until flow runs).
Please click Mark as Best Response & Like if my post helped you to solve your issue. This will help others to find the correct solution easily. It also closes the item. If the post was useful in other ways, please consider giving it Like.
- Djeanthi2215Jan 30, 2024Copper ContributorAs per #1, can I use 'person or group' as type instead of Text field to store the details using User().
- ganeshsanapJan 30, 2024MVP
Djeanthi2215 You can use either of the column types - based on your requirements.
Check these links for auto-populating person or group type column:
Please click Mark as Best Response & Like if my post helped you to solve your issue. This will help others to find the correct solution easily. It also closes the item. If the post was useful in other ways, please consider giving it Like.
- Djeanthi2215Jan 30, 2024Copper ContributorWhen I duplicating the list, created by field as my name. I wanted to have the original user who entered the old items of the list. So I have added another field 'Empname 1'. In this field I want to have the user name as the default value. How to achieve this.
- Rob_ElliottJan 30, 2024Silver Contributor
Djeanthi2215 you'll need to build a simple flow in Power Automate to do this.
Rob
Los Gallardos
Microsoft Power Automate Community Super User.
Principal Consultant, SharePoint and Power Platform WSP Global (and classic 1967 Morris Traveller driver)