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
Solved! Go to Solution.
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
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
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.
That's terrific, it worked a treat.
Thanks,
Stephen
This training provides practical hands-on experience in creating Power Apps solutions in a full-day of instructor-led App creation workshop.
Come together to explore latest innovations in code and application development—and gain insights from experts from around the world.
User | Count |
---|---|
196 | |
69 | |
49 | |
46 | |
18 |
User | Count |
---|---|
249 | |
126 | |
84 | |
75 | |
74 |