cancel
Showing results for 
Search instead for 
Did you mean: 
Reply
CWileyRRT
Helper IV
Helper IV

Patch People Field from Combo Box & Patch Choice Field

I have 2 more columns I just cannot get patched as new records no matter how much research and trial/error.

 

I currently have a combo box that searched the active directory and allows you to select an individual. I cannot get this selected individual to patch to a SPList people column. This will be for both New and Updating records.

 

Additionally, I have a choice column on the SPList, I want to pass along the "Approved" option as this new record is created.

1 ACCEPTED SOLUTION

Accepted Solutions

I think it should be Selected not SelectedItems


so Requester_1.Selected.Mail

and

Requester_1.Selected.DisplayName

View solution in original post

9 REPLIES 9

To patch a person field You need to provide all of the below fields in your patch but you only need to provide the email address at the end of the claim row, the display name (full name) in the DisplayName field, and the Email Address in the Email address line.:

 

Patch{
    'List name'
    {ID:textInput1.Text},
    {
      Person: {
    '@odata.type': "#Microsoft.Azure.Connectors.SharePoint.SPListExpandedUser",
    Claims: "i:0#.f|membership|<EMAIL-ADDRESS>",
    Department: "",
     DisplayName: <DISPLAYNAME>,
    Email: <EMAILADDRESS>,
    JobTitle: "",
    Picture: ""
   }
  }
}

 

To patch a choices field:

 

 

    Patch(
        Timesheet,
        recordid,
        {

            Status: {
                Value: "Approved",
                '@odata.type': "#Microsoft.Azure.Connectors.SharePoint.SPListExpandedReference"
            }
        }
    )
);

 

@CWileyRRT  if this answers your question, please mark it as a solution.

 

So I'm wondering if thats part of the issue, the combo box value where I selected the person does not let me grab the email address of the user it selected. I tried patching the displayname but still get an error.

 

Here are the fields that I can get from the value that auto populate once I recall the Requester_1.SelectedItems.(AVAILABLE OPTIONS)

 

AccountEnabled

BusinessPhones

City

Company Name

Country

Department

DisplayName

GivenName

ID

JobTitle

Mail

MailNickname

mobilePhone

OfficeLocation

PostalCode

Surname

TelephoneNumber

UserPrincipleName

 

Error.jpg

 

 

 

 

 

Here is the code from the combobox that allows me to search and select a user from AD

 

Microsoft365Users.SearchUser({searchTerm:Requester_1.SearchText,top:10})

Yes you need the email address. Fortunately you can get it if you have the display name 

 

add the o365 user connector to your app

then

Office365Users.SearchUser({searchTerm: DisplayName.Text}).Mail

 

assumes you have a field called display name 

 

I made a video about this https://youtu.be/I_rvBt6fYUY

 

 

I have the 365 connector already added which helps search and select the Requesting User.

 

So for the command you sent, do I put that in the email field of the patch request?  The combo box where the requester was selected is Requester_1

 

{
'Reserved By': {
'@odata.type': "#Microsoft.Azure.Connectors.SharePoint.SPListExpandedUser",
Claims: "i:0#.f|membership| Office365Users.SearchUser({searchTerm: Requester_1.Text}).Mail",
Department: "",
DisplayName: <DISPLAYNAME>,
Email: <EMAILADDRESS>,
JobTitle: "",
Picture: ""
}
},

 

 

So I think the claims line should be like

Claims: "i:0#.f|membership|", Office365Users.SearchUser({searchTerm: Requester_1.Text}).Mail,

I just checked another one and it should be like the following. You need to replace <DISPLAYNAME> with the display name of the user and the email address also goes in the Email: line

{
'Reserved By': {
'@odata.type': "#Microsoft.Azure.Connectors.SharePoint.SPListExpandedUser",
Claims: "i:0#.f|membership|", Office365Users.SearchUser({searchTerm: Requester_1.Text}).Mail,
Department: "",
DisplayName: <DISPLAYNAME>,
Email: <EMAILADDRESS>,
JobTitle: "",
Picture: ""
}
},

Still no luck. I tried what you posted. I'm wondering if its because the combo box produces a selected item? I tried the following which is a modification of the code I use for CurrentUser.

 

{
'Reserved By': {
'@odata.type': "#Microsoft.Azure.Connectors.SharePoint.SPListExpandedUser",
Claims: "i:0#.f|membership|" & Requester_1.SelectedItems.Mail,
Department: "",
DisplayName: Requester_1.SelectedItems.DisplayName,
Email: Requester_1.SelectedItems.Mail,
JobTitle: "",
Picture: ""
}
},

I think it should be Selected not SelectedItems


so Requester_1.Selected.Mail

and

Requester_1.Selected.DisplayName

View solution in original post

FINALLY! Thank you, "Selected" doesnt come up in the suggested options so I didnt think about it.

Helpful resources

Announcements
UG GA Amplification 768x460.png

Launching new user group features

Learn how to create your own user groups today!

Community Connections 768x460.jpg

Community & How To Videos

Check out the new Power Platform Community Connections gallery!

M365 768x460.jpg

Microsoft 365 Collaboration Conference | December 7–9, 2021

Join us, in-person, December 7–9 in Las Vegas, for the largest gathering of the Microsoft community in the world.

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