cancel
Showing results for 
Search instead for 
Did you mean: 
Reply
sachk1
Helper III
Helper III

auto populate username of form filled user

Hi, 

 

I have a person/group column in SharePoint list. Through the form I want to pass the form filled users username to it. and this will not be change in display form. need to get the username automatically when user filled the form and it should be on disabled mode.

currently When I do this it will submit the username but when any other user view it from sharepoint his/her username will appers, not the original username who submitted.

 

how can I solve this issue? need help.

 

sachk1_0-1662519907994.png

 

 

 

 

1 ACCEPTED SOLUTION

Accepted Solutions

Hi you can use below formula 

If(SharePointForm1.Mode=FormMode.New, {

Claims: "i:0#.f|membership|" & Lower(User().Email),

DisplayName: User().FullName,

Email: User().Email,

Picture: "",

Department: "",

JobTitle: ""}, Parent.Default)

Add the above formula in DefaultSelectedItems property 


Did you like my post? Please give it a thumbs up! Did I resolve your issue? Please click Accept as Solution to close the topic and so other members of the community can find solutions more easily.

View solution in original post

4 REPLIES 4
NandiniBhagya20
Solution Sage
Solution Sage

Hi,

In the defaultselecteditems property of your person data card you have to add condition to check whether form is on which mode -

If(SharePointForm1.Mode=FormMode.New, {Your formula to set current logged in user}, Parent.Default)


Did you like my post? Please give it a thumbs up! Did I resolve your issue? Please click Accept as Solution to close the topic and so other members of the community can find solutions more easily.

@NandiniBhagya20 ,

Hi , thank your for your response. I think the way I check the user is also a problem. Can you let me know how to get that. Follow code is I used to fill the field with current logged user.

 

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

 

This code both written on default and defaultselecteditems.

 

 

Hi you can use below formula 

If(SharePointForm1.Mode=FormMode.New, {

Claims: "i:0#.f|membership|" & Lower(User().Email),

DisplayName: User().FullName,

Email: User().Email,

Picture: "",

Department: "",

JobTitle: ""}, Parent.Default)

Add the above formula in DefaultSelectedItems property 


Did you like my post? Please give it a thumbs up! Did I resolve your issue? Please click Accept as Solution to close the topic and so other members of the community can find solutions more easily.

Thank you.

Helpful resources

Announcements
Power Apps News & Annoucements carousel

Power Apps News & Announcements

Keep up to date with current events and community announcements in the Power Apps community.

Community Call Conversations

Introducing the Community Calls Conversations

A great place where you can stay up to date with community calls and interact with the speakers.

Power Apps Community Blog Carousel

Power Apps Community Blog

Check out the latest Community Blog from the community!

Top Solution Authors
Top Kudoed Authors
Users online (4,831)