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

Patch person from ComboBox to SP People

Hi, 

 

I have SP list contain People and Group column, and I create a PowerApps form contain a ComboBox that search all users by 

Items: 

Office365Users.SearchUser()

so it's list all the users.

 

Now I need to patch any selected user from this ComboBox to the SP list

 

I already used the following code but it's not working with me 

 

 

RequesterName:{

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

               }

is there a missing part in this formula or any other best practice ?

 

Thanks

10 REPLIES 10
Edwin-Abdalian
Level 10

Re: Patch person from ComboBox to SP People

isn't it working at all or you get an error, or it always patches the current user? in your formula, you always pass the current user to the patch function.

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

 but you wanted the selected users from the combobox to be patched, right?

ElMeSaFeR
Level: Powered On

Re: Patch person from ComboBox to SP People

exactly it's showing argument error.

yes, I want the selected users from the combobox to be patched
but the destination column is person and group type
Edwin-Abdalian
Level 10

Re: Patch person from ComboBox to SP People

please post the entire patch function, so I can trace the formula

Edwin-Abdalian
Level 10

Re: Patch person from ComboBox to SP People

Basically you need to capture the selected user in a variable and then use the variable in your patch function.

OnChange of your combobox, create these variables:

UpdateContext(
{
locSelectedUserEmail: Lower(First(ComboBox4.SelectedItems).Mail),
locSelectedUserDisplayName: First(ComboBox4.SelectedItems).DisplayName
}
)

and then use the variable wherever applicable

RequesterName:{

                 '@odata.type': 
                 "#Microsoft.Azure.Connectors.SharePoint.SPListExpanderUser",
                 Claims:"i:0#.f|membership|" & locSelectedUserEmail,
                 Department:"",
                 DisplayName: locSelectedUserDisplayName,
                 Email: locSelectedUserEmail,
                 JobTitle: ".",
                 Picture:"."

               }

 

ElMeSaFeR
Level: Powered On

Re: Patch person from ComboBox to SP People

RequesterName01.PNG

 

 

same error !

Edwin-Abdalian
Level 10

Re: Patch person from ComboBox to SP People

don't pass the display name, just set it to ""

also please share the entire Patch function

ElMeSaFeR
Level: Powered On

Re: Patch person from ComboBox to SP People

Patch
      ('MyAppName',Defaults('MyAppName'),
     
        {    
        Title: 

                    TextInput2_11.Text,

    
'Details': 

                   
                    TextInput1_1.Text,
               
'Type':{

                  '@odata.type': "#Microsoft.Azure.Connectors.SharePoint.SPListExpandedReference",
                   Value: "New"

            },

Department: Dropdown6_1.Selected,


RequesterName:{

                 '@odata.type': 
                 "#Microsoft.Azure.Connectors.SharePoint.SPListExpanderUser",
                 Claims:"i:0#.f|membership|" & locSelectedUserEmail,
                 Department:"",
                 DisplayName: locSelectedUserDisplayName,
                 Email: locSelectedUserEmail,
                 JobTitle: ".",
                 Picture:"."

               }
               
        }
            
)
Edwin-Abdalian
Level 10

Re: Patch person from ComboBox to SP People

the problem is where you don't get the Text value from the dropdown. the red text below. 

Department: Dropdown6_1.Selected.Value 

Patch
      ('MyAppName',Defaults('MyAppName'),
     
        {    
        Title: 

                    TextInput2_11.Text,

    
'Details': 

                   
                    TextInput1_1.Text,
               
'Type':{

                  '@odata.type': "#Microsoft.Azure.Connectors.SharePoint.SPListExpandedReference",
                   Value: "New"

            },

Department: Dropdown6_1.Selected.Value,


RequesterName:{

                 '@odata.type': 
                 "#Microsoft.Azure.Connectors.SharePoint.SPListExpanderUser",
                 Claims:"i:0#.f|membership|" & locSelectedUserEmail,
                 Department:"",
                 DisplayName: locSelectedUserDisplayName,
                 Email: locSelectedUserEmail,
                 JobTitle: ".",
                 Picture:"."

               }
               
        }
            
)

 

ElMeSaFeR
Level: Powered On

Re: Patch person from ComboBox to SP People

I really appreciate your help, I don't have any problems with the other codes except person patch

 

If I delete 

 

RequesterName:{

                 '@odata.type': 
                 "#Microsoft.Azure.Connectors.SharePoint.SPListExpanderUser",
                 Claims:"i:0#.f|membership|" & locSelectedUserEmail,
                 Department:"",
                 DisplayName: locSelectedUserDisplayName,
                 Email: locSelectedUserEmail,
                 JobTitle: ".",
                 Picture:"."

               }

the code is working fine, also after I add ".value" I got another error 

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 (7,137)