web
You’re offline. This is a read only version of the page.
close
Skip to main content

Notifications

Announcements

Community site session details

Community site session details

Session Id :
Power Platform Community / Forums / Power Apps / PowerApp - Patch Peopl...
Power Apps
Unanswered

PowerApp - Patch People field from a collection

(0) ShareShare
ReportReport
Posted on by 94

I am trying to patch a Person or Group field from a collection but it is not reflecting when an item is submitted. Other values from the collection are getting updated.

 

Combo box Code:

Clear(collectUsers);
ForAll(DataCardValue3.SelectedItems As ThisUser,

If(!IsBlank(ThisUser.Mail),
Collect(collectUsers,
{
Name: ThisUser.DisplayName,
EmployeeID: 'GetUserADdetails'.Run(ThisUser.Mail).employeeid,
Username: 'GetUserADdetails'.Run(ThisUser.Mail).samaccountname,
Email: ThisUser.Mail,
JobTitle: ThisUser.JobTitle,
NokiaID: ThisUser.UserPrincipalName,
LineManager: Office365Users.Manager(ThisUser.Id).DisplayName,
Department: ThisUser.Department,
FirstName: ThisUser.GivenName,
LastName: ThisUser.Surname,
LineManagerEmail: Office365Users.Manager(ThisUser.Id).Mail,
LMID: Office365Users.Manager(ThisUser.Id).Id
}
)
)


Submit Button Code looks like: 

 

ForAll(
collectUsers,
Patch(
Mass_Access_Request,
Defaults(Mass_Access_Request),
{
'Requested By': DataCardValue1.Text,
'Requested For':{'@odata.type':"#Microsoft.Azure.Connectors.SharePoint.SPListExpandedUser",
Claims: "i:0#.f|membership|" & Lower(ThisRecord.Email),
Department: ThisRecord.Department,
DisplayName: ThisRecord.Name,
Email: ThisRecord.Email,
JobTitle: "",
Picture: ""
},
'E-mail Address':ThisRecord.Email,
'ID':ThisRecord.EmployeeID,
'User Account Name':ThisRecord.Username,
'First Name':ThisRecord.FirstName,
'Last Name':ThisRecord.LastName,
'Position Title':ThisRecord.JobTitle,
'Organization Name':ThisRecord.Department,
'Line Manager':ThisRecord.LineManager,

ActionType: {Value: DataCardValue2.Selected.Value},

 

Categories:
I have the same question (0)
  • Al_10 Profile Picture
    1,691 Super User 2024 Season 1 on at

    @Neha2904 

     

    'Requested For' is a Person datatype column in the 'Mass_Access_Request' SP list?

     

     

     

    
    ForAll( collectUsers,
     Patch( Mass_Access_Request, Defaults(Mass_Access_Request),
     {
     'Requested By': DataCardValue1.Text,
     'Requested For':
     {
     '@odata.type': "#Microsoft.Azure.Connectors.SharePoint.SPListExpandedUser",
     Claims: "i:0#.f|membership|" & Lower(ThisRecord.UserPrincipalName),
     Department: ThisRecord.Department,
     DisplayName: ThisRecord.Name,
     Email: ThisRecord.Email,
     JobTitle: "",
     Picture: ""
     },
     'E-mail Address': ThisRecord.Email,
     'ID': ThisRecord.EmployeeID,
     'User Account Name': ThisRecord.Username,
     'First Name': ThisRecord.FirstName,
     'Last Name': ThisRecord.LastName,
     'Position Title': ThisRecord.JobTitle,
     'Organization Name': ThisRecord.Department,
     'Line Manager': ThisRecord.LineManager,
     ActionType: {Value: DataCardValue2.Selected.Value}
     }
     )
    )

     

     

  • Neha2904 Profile Picture
    94 on at

    Thanks for the response @Alex_10 

    Yes, it is a person field, and it is not working with the suggested code. It is posting blank value.

    Neha2904_0-1640884656499.png

     

  • Al_10 Profile Picture
    1,691 Super User 2024 Season 1 on at

    @Neha2904 

     

    how do you know if your code for combobox works well?

    Clear(collectUsers);
    ForAll(DataCardValue3.SelectedItems As ThisUser,
    
    If(!IsBlank(ThisUser.Mail),
    Collect(collectUsers,
    {
    Name: ThisUser.DisplayName,
    EmployeeID: 'GetUserADdetails'.Run(ThisUser.Mail).employeeid,
    Username: 'GetUserADdetails'.Run(ThisUser.Mail).samaccountname,
    Email: ThisUser.Mail,
    JobTitle: ThisUser.JobTitle,
    NokiaID: ThisUser.UserPrincipalName,
    LineManager: Office365Users.Manager(ThisUser.Id).DisplayName,
    Department: ThisUser.Department,
    FirstName: ThisUser.GivenName,
    LastName: ThisUser.Surname,
    LineManagerEmail: Office365Users.Manager(ThisUser.Id).Mail,
    LMID: Office365Users.Manager(ThisUser.Id).Id
    }
    )
    )

    you use 2 flow calls and 3 office calls in that code, not sure if that collection is populated.

    can you share a screenshot of the collection collectUsers after you add a person?

     

    what is ID column? Was it created by you or a standard default Sharepoint column?

    'ID': ThisRecord.EmployeeID,

     

     

  • Neha2904 Profile Picture
    94 on at

    The ID column is created by me to store the employee ID.

    the collection is getting populated.

    Neha2904_2-1640941024717.png

     

     

  • Verified answer
    Al_10 Profile Picture
    1,691 Super User 2024 Season 1 on at

    @Neha2904 

     

    I dont know how you could create a column in Sharepoint list with the name ID as it is a reserved name...

     

     

    can you check if the following code creates a record in Mass_Access_Request SharePoint list

    ForAll( collectUsers,
     Patch( Mass_Access_Request, Defaults(Mass_Access_Request),
     {
     'Requested By': DataCardValue1.Text,
     'Requested For':
     {
     '@odata.type': "#Microsoft.Azure.Connectors.SharePoint.SPListExpandedUser",
     Claims: "i:0#.f|membership|" & Lower(ThisRecord.NokiaID),
     Department: ThisRecord.Department,
     DisplayName: ThisRecord.Name,
     Email: ThisRecord.Email,
     JobTitle: "",
     Picture: ""
     },
     'E-mail Address': ThisRecord.Email,
     'User Account Name': ThisRecord.Username,
     'First Name': ThisRecord.FirstName,
     'Last Name': ThisRecord.LastName,
     'Position Title': ThisRecord.JobTitle,
     'Organization Name': ThisRecord.Department,
     'Line Manager': ThisRecord.LineManager,
     ActionType: {Value: DataCardValue2.Selected.Value}
     }
     )
    )

     

  • Neha2904 Profile Picture
    94 on at

    Thanks. It did not work with Powerapp, so I created a flow to update the Claims

Under review

Thank you for your reply! To ensure a great experience for everyone, your content is awaiting approval by our Community Managers. Please check back later.

Helpful resources

Quick Links

Forum hierarchy changes are complete!

In our never-ending quest to improve we are simplifying the forum hierarchy…

Ajay Kumar Gannamaneni – Community Spotlight

We are honored to recognize Ajay Kumar Gannamaneni as our Community Spotlight for December…

Leaderboard > Power Apps

#1
WarrenBelz Profile Picture

WarrenBelz 796 Most Valuable Professional

#2
Michael E. Gernaey Profile Picture

Michael E. Gernaey 327 Super User 2025 Season 2

#3
Power Platform 1919 Profile Picture

Power Platform 1919 268

Last 30 days Overall leaderboard