cancel
Showing results for 
Search instead for 
Did you mean: 
Reply
smcb123
Helper I
Helper I

Using User() to populate person or group sharepoint list

Hi,

 

I'm trying to automatically populate a sharepoint list person or group field by using the user function, however I can't get this to work.

 

I have a 'creator' field which I want to be automatically set to the current user. I have a create form in which this field won't be available, so I have the visibility set to false. Within the default of the data card, I try to enter User().FullName, however it doesn't like this and gives a squiggly line.

 

It will accept simply User(). If I set visibility to true, I can see that nothing gets populated and when I save the record I can see in sharepoint that nothing has been saved.

 

Does anyone have any ideas?

 

Thanks,

 

Stephen

1 ACCEPTED SOLUTION

Accepted Solutions
rubin_boer
Super User
Super User

hi @smcb123 , i'm curious why are you not just using the "created by" column in SharePoint, it will give you the same information.

 

you can create a variablelike this

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

 set the defaults items to _CurrentUser and it will save the record - just can't see why though.

 

Hope it helps

R

View solution in original post

3 REPLIES 3
rubin_boer
Super User
Super User

hi @smcb123 , i'm curious why are you not just using the "created by" column in SharePoint, it will give you the same information.

 

you can create a variablelike this

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

 set the defaults items to _CurrentUser and it will save the record - just can't see why though.

 

Hope it helps

R

View solution in original post

ScottShearer
Super User
Super User

@smcb123 

In addition to the information provided by @rubin_boer you might find this video from @aprildunnam helpful as well.  The demonstration on defaulting a person or group column the the current user starts at about 6 minutes in.

 

 

If I have answered your question, please mark your post as Solved.
If you like my response, please give it a Thumbs Up.

Scott

That's terrific, it worked a treat.

 

Thanks,

 

Stephen

Helpful resources

Announcements
User Group Leader Meeting January 768x460.png

Calling all User Group Leaders!

Don't miss the User Group Leader meetings on January, 24th & 25th, 2022.

Community Connections 768x460.jpg

Community & How To Videos

Check out the new Power Platform Community Connections gallery!

Top Solution Authors
Top Kudoed Authors
Users online (2,654)