cancel
Showing results for 
Search instead for 
Did you mean: 
Reply
Highlighted
FacundoGorla
Level: Powered On

Save the current user using the powerapp to a person column in a sharepoint list.

Hi, currently working in an App to registry tasks from a group of users using a SharePoint list as a database.

 

The idea would be that an User column of the list automatically gets the user profile of the the one using the app to save a new element (task).

 

I thought this would be as simple as put MyProfile() using the O365 connector as default value in the User column but to my surprise as a Person column is basically a lookup column when you save a new element, even when you can see the displayname of the user selected to go into the column, this would save as empty! 

 

As a workaround I used a Singleline text value to save the displayname of the user with it's default property and it worked fine.

 

But as I'm moving forward with the app now I want to make a gallery to filter the task list and it would be nice to use the user profile properties as photo, e-mail, etc. and I can't since I don't have the profile anywhere.

 

Is there a way to auto-save a user profile into a person column?

 

 

1 ACCEPTED SOLUTION

Accepted Solutions
v-siky-msft
Level 10

Re: Save the current user using the powerapp to a person column in a sharepoint list.

Hi @FacundoGorla ,

 

The column of table that UsuariosdeOffice365.MyProfile() function return is different from the person column in SharePoint, so you shouldn't submit the UsuariosdeOffice365.MyProfile() to Person column directly.

The person column contains Claims, Department, DisplayName, Email, JobTitle, Picture columns. so if you want to submit the current user to it,  please put the following formulas to Update property of user Datacard.

 

{Claims:"i:0#.f|membership|" & User().Email,Department:"",DisplayName:"",Email:"",JobTitle:"",Picture:""}

 

Note: you can use User().Email to get the current login user's email.

Please have a try and check if your issue is fixed. if not ,please post back the error detail.

Best regards,

Sik

If my post is helpful for you, please click on “Accept as Solution” to help other members find it more quickly.

View solution in original post

4 REPLIES 4
v-siky-msft
Level 10

Re: Save the current user using the powerapp to a person column in a sharepoint list.

Hi @FacundoGorla ,

Can you share more details with your apps? when do you want to patch the User to SP list?

If you want to patch user to Person column, please refer to the following formula:

Patch('SP list', First('SP list'), {User:{Claims:"i:0#.f|membership|" & User().Email,Department:"",DisplayName:"",Email:"",JobTitle:"",Picture:""}})

This formulas is to patch current user to User column of first item. please have a try and check if your issue is fixed.

Best regards,

Sik

If my post is helpful for you, please click on “Accept as Solution” to help other members find it more quickly.

FacundoGorla
Level: Powered On

Re: Save the current user using the powerapp to a person column in a sharepoint list.

Hi, thanks por the response. The user fill a form to create a new "task" that saves in the SharePoint list.

I have the column "User" as not visible and the default value of the datacard is "UsuariosdeOffice365.MyProfile()" wich autoselects the profile of the user using the app, but when it saves the form this value does not save into the user column.

 

I would like to patch the column when the user saves the form so I'll put it in the saving button.

Right now I was making it work with a text column that saves the user's ID so later if I need to get any user info I would use a function that ask for the ID for example "UsuariosdeOffice365.userphoto(ID)"

 

 

v-siky-msft
Level 10

Re: Save the current user using the powerapp to a person column in a sharepoint list.

Hi @FacundoGorla ,

 

The column of table that UsuariosdeOffice365.MyProfile() function return is different from the person column in SharePoint, so you shouldn't submit the UsuariosdeOffice365.MyProfile() to Person column directly.

The person column contains Claims, Department, DisplayName, Email, JobTitle, Picture columns. so if you want to submit the current user to it,  please put the following formulas to Update property of user Datacard.

 

{Claims:"i:0#.f|membership|" & User().Email,Department:"",DisplayName:"",Email:"",JobTitle:"",Picture:""}

 

Note: you can use User().Email to get the current login user's email.

Please have a try and check if your issue is fixed. if not ,please post back the error detail.

Best regards,

Sik

If my post is helpful for you, please click on “Accept as Solution” to help other members find it more quickly.

View solution in original post

FacundoGorla
Level: Powered On

Re: Save the current user using the powerapp to a person column in a sharepoint list.

Sorry if it's a dumb question but what do I put in the default property?

Already changed the Update.

 

EDIT: didn't put anything and it worked using the Update property as you suggested. Great solution so far.

Another doubt is if the values of the user propoerties are going to be usable and with the correct info of the user?

 

For example Department that I leave "" in the Update property will have the correct data of the user?

Helpful resources

Announcements
thirdimage

Power Automate Community User Group Member Badge

Fill out a quick form to claim your user group badge now!

sixthImage

Power Platform World Tour

Find out where you can attend!

Power Platform 2019 release wave 2 plan

Power Platform 2019 release wave 2 plan

Features releasing from October 2019 through March 2020

fifthimage

Microsoft Learn

Learn how to build the business apps that you need.

Top Kudoed Authors (Last 30 Days)
Users online (5,711)