Use current user as default value in a Person or Group field in SharePoint list

John Doe 16 Reputation points
2020-10-14T14:07:00.347+00:00

Hi,

I have added a Person or Group field in a SharePoint Online List (also exposed through Team/Microsoft Lists) and I want the current user is the default value. How can I achieve this?

Thanks,
John

SharePoint Server
SharePoint Server
A family of Microsoft on-premises document management and storage systems.
2,227 questions
SharePoint
SharePoint
A group of Microsoft Products and technologies used for sharing and managing content, knowledge, and applications.
9,682 questions
SharePoint Server Development
SharePoint Server Development
SharePoint Server: A family of Microsoft on-premises document management and storage systems.Development: The process of researching, productizing, and refining new or existing technologies.
1,575 questions
{count} votes

4 answers

Sort by: Most helpful
  1. Allen Xu_MSFT 13,776 Reputation points
    2020-10-15T09:35:15.933+00:00

    Hi @John Doe ,

    Which version of experience are you applying to your SharePoint Online list, modern experience or classic experience?

    If you are using modern experience, please refer to the following steps:

    1. Go to your list->Power Apps->Customize forms:
      32624-1015-1.png

    2) Click FormScreen1 on the left Tree view->Advanced on the right->OnVisible->fill the text box with following code:

    32632-1015-2.png

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

    3) Click the people or group field DataCard(which is named Name_DataCard1 in my example) on the left Tree view:
    32600-1015-3.png

    Go to Advanced on the right and click on unlock to change properties->fill the variable to “CurrentUser” in the Default column as shown below:
    32654-1015-4.png

    4) Save the form and publish it to SharePoint. Then you can see the people or group field has been populated with the current user when you “New” item in your list.

    If you are using classic experience, please refer to this article to use JS code to meet your needs:
    SharePoint Online: Set Current User as Default Value in Person or Group Field

    Note: Microsoft is providing this information as a convenience to you. The sites are not controlled by Microsoft. Microsoft cannot make any representations regarding the quality, safety, or suitability of any software or information found there. Please make sure that you completely understand the risk before retrieving any suggestions from the above link.

    I hope this information has been useful, please let me know if you still need assistance.


    If an Answer is helpful, please click "Accept Answer" and upvote it.
    Note: Please follow the steps in our documentation to enable e-mail notifications if you want to receive the related email notification for this thread.

    10 people found this answer helpful.

  2. Sharath Kumar Aluri 3,071 Reputation points
    2020-10-14T15:24:21.357+00:00

    If your SharePoint Online Site is using classic experience then you could use below JavaScript for your requirement:

    Reference: https://www.sharepointdiary.com/2020/02/sharepoint-online-set-person-group-field-default-value-to-current-user.html

    If your SharePoint Online site is using Modern Experience then you could do it using PowerApps, below article will help to do via PowerApps.

    https://www.c-sharpcorner.com/article/set-current-user-as-default-value-of-person-group-field-in-powerapps/

    Thanks & Regards,

    1 person found this answer helpful.

  3. Martin Coupal 1 Reputation point
    2020-12-01T21:29:01.653+00:00

    Maybe using Power Automate and "On new list Item" copy created by into your people field?

    0 comments No comments

  4. GIUGNO Maria (RIC-US) 0 Reputation points
    2023-02-06T16:10:57.08+00:00

    Has anyone configured this using sky bow Modern forms? Thanks!

    0 comments No comments