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 / Patch user details to ...
Power Apps
Suggested Answer

Patch user details to SharePoint

(1) ShareShare
ReportReport
Posted on by 41
I have a multi form app that uses a combo box to search for an employee, when found the employee details along with the manager details are displayed in text boxes. when I use the "Patch" command to send the details to SharePoint only the Manager details appear in the SharePoint list.

The columns in the SharepPoint list are both people/groups. I can't work out why it will work for the manager details but not the employee details. Can anyone see what is wrong with my "patch" code? There are no errors displayed in the function screen
 
// Check if all forms are valid
If(
    Form1_1.Valid && Form2.Valid && Form1.Valid,
    // Patch the data to the SharePoint list
    With(
        {
            result: Patch(
                'Journey Management Plan Risk Assesment',
                Defaults('Journey Management Plan Risk Assesment'),
               
                // Manually setting fields like Employee and Manager
                {
                    Employee: {
                        Claims: "i:0#.f|membership|" & Lower(LookUp(ComboBox1.SelectedItems,1=1).Mail),
                        DisplayName: LookUp(ComboBox1.SelectedItems,1=1).DisplayName,
                        Email: LookUp(ComboBox1.SelectedItems,1=1).Mail,
                        Department: LookUp(ComboBox1.SelectedItems,1=1).Department,
                        JobTitle: LookUp(ComboBox1.SelectedItems,1=1).JobTitle,
                        Picture: ""  // If you have a picture URL or field, include it here
                    },
                    ManagerName: {
                        Claims: "i:0#.f|membership|" & Lower(Office365Users.ManagerV2(ComboBox1.Selected.Id).mail),
                        DisplayName: Office365Users.ManagerV2(ComboBox1.Selected.Id).displayName,
                        Email: Office365Users.ManagerV2(ComboBox1.Selected.Id).mail,
                        Department: "",  // If Manager's department is available, include it
                        JobTitle: "",  // If Manager's job title is available, include it
                        Picture: ""  // If Manager's picture URL or field is available, include it
                    }
                },
               
                // Apply all form updates from Form1_1, Form2, Form1, and Form3
                Form1_1.Updates,
                Form2.Updates,
                Form1.Updates,
                Form3.Updates
            )
        },
        // Check if the patch was successful
        If(
            IsError(result), // Check for errors instead of IsEmpty
            Notify("Error submitting forms", NotificationType.Error),
            // Navigate to Screen6 if successful
            Navigate(Screen6, ScreenTransition.Fade)
        )
    )
);


 
Categories:
I have the same question (0)
  • realwillwright Profile Picture
    772 Moderator on at
    Hi 
     
    Can you try adding this line to a label to see what value is returned
     
    Lower(Office365Users.ManagerV2(ComboBox1.Selected.Id).mail)
     
  • realwillwright Profile Picture
    772 Moderator on at
    If the first suggestion works try updating the patch to add the get manager details to the with as a variable instead of calling it three times in the body
     
    // Check if all forms are valid
    If(
        Form1_1.Valid && Form2.Valid && Form1.Valid,
        // Patch the data to the SharePoint list
        With(
            {
                manager: Office365Users.ManagerV2(ComboBox1.Selected.Id),
                result: Patch(
                    'Journey Management Plan Risk Assesment',
                    Defaults('Journey Management Plan Risk Assesment'),
                   
                    // Manually setting fields like Employee and Manager
                    {
                        Employee: {
                            Claims: "i:0#.f|membership|" & Lower(LookUp(ComboBox1.SelectedItems,1=1).Mail),
                            DisplayName: LookUp(ComboBox1.SelectedItems,1=1).DisplayName,
                            Email: LookUp(ComboBox1.SelectedItems,1=1).Mail,
                            Department: LookUp(ComboBox1.SelectedItems,1=1).Department,
                            JobTitle: LookUp(ComboBox1.SelectedItems,1=1).JobTitle,
                            Picture: ""  // If you have a picture URL or field, include it here
                        },
                        ManagerName: {
                            Claims: "i:0#.f|membership|" & Lower(manager.mail),
                            DisplayName: manager.displayName,
                            Email: manager.mail,
                            Department: "",  // If Manager's department is available, include it
                            JobTitle: "",  // If Manager's job title is available, include it
                            Picture: ""  // If Manager's picture URL or field is available, include it
                        }
                    },
                   
                    // Apply all form updates from Form1_1, Form2, Form1, and Form3
                    Form1_1.Updates,
                    Form2.Updates,
                    Form1.Updates,
                    Form3.Updates
                )
            },
            // Check if the patch was successful
            If(
                IsError(result), // Check for errors instead of IsEmpty
                Notify("Error submitting forms", NotificationType.Error),
                // Navigate to Screen6 if successful
                Navigate(Screen6, ScreenTransition.Fade)
            )
        )
    );
     
  • Suggested answer
    CA1105 Profile Picture
    545 Super User 2025 Season 2 on at
     Are the ComboBox1 bineded with people/groups column in SharePoint list? If so, what is the need of writing Lookup function. You can just simply wright
    ComboBox1.SelectedItems.DisplayName
    ComboBox1.SelectedItems.Mail and so on...
     
  • Suggested answer
    mmbr1606 Profile Picture
    14,605 Super User 2025 Season 2 on at
    hey
     
    what you can try is something like this:
    If(
        Form1_1.Valid && Form2.Valid && Form1.Valid,
        With(
            {
                result: Patch(
                    'Journey Management Plan Risk Assesment',
                    Defaults('Journey Management Plan Risk Assesment'),
                    {
                        Employee: {
                            Claims: "i:0#.f|membership|" & Lower(ComboBox1.Selected.Mail),
                            DisplayName: ComboBox1.Selected.DisplayName,
                            Email: ComboBox1.Selected.Mail,
                            Department: ComboBox1.Selected.Department,
                            JobTitle: ComboBox1.Selected.JobTitle,
                            Picture: ""
                        },
                        ManagerName: {
                            Claims: "i:0#.f|membership|" & Lower(Office365Users.ManagerV2(ComboBox1.Selected.Id).mail),
                            DisplayName: Office365Users.ManagerV2(ComboBox1.Selected.Id).displayName,
                            Email: Office365Users.ManagerV2(ComboBox1.Selected.Id).mail,
                            Department: "",
                            JobTitle: "",
                            Picture: ""
                        }
                    },
                    Form1_1.Updates,
                    Form2.Updates,
                    Form1.Updates,
                    Form3.Updates
                )
            },
            If(
                IsError(result),
                Notify("Error submitting forms", NotificationType.Error),
                Navigate(Screen6, ScreenTransition.Fade)
            )
        )
    );
    
    if this helps, please mark as verified answer
  • LauraleeG Profile Picture
    41 on at
    Sorry I'm not sure my first message was clear, the Manager details are fine in the SharePoint list, it's the employee details that won't show up
     
  • Suggested answer
    Michael E. Gernaey Profile Picture
    53,412 Super User 2025 Season 2 on at
    Why does your Employee have a LookUp where the criteria is 1=1
     
    What is the point of that?
     
    Does your Column actually allow for duplicates??? If not then you dont need to do that just use ComboBox1.Selected
     
    Also you should really rename this stuff... 
     
    Wait.. you are using the same logic for the Manager and the Employee as it relates to where you get the data.
     
    How can ComboBox1 be the answer for both Employee and Manager, that makes no sense? Can you share your screen please (a picture of the controls/forms)
     
     
  • LauraleeG Profile Picture
    41 on at
    Unfortunately I am not the original creator of this app, I have been asked to "fix" it and "make it work", so the naming of controls etc was previously set up by someone else.

    It doesn't allow duplicates, but if I leave the 1=1 out of the code it shows up as an error.
     
    So combobox1 is a drop down search of the employees in Office365Users there is a text label that then shows the employee name, and another label that then uses the Office365Users.ManagerV2 to get that employees manager details and displays it.
     
    Office365Users.ManagerV2(ComboBox1.Selected.Id).displayName
     
    As I said before the Manager details are sent to the sharepoint list the employee name is not?
     

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 721 Most Valuable Professional

#2
Michael E. Gernaey Profile Picture

Michael E. Gernaey 320 Super User 2025 Season 2

#3
Power Platform 1919 Profile Picture

Power Platform 1919 268

Last 30 days Overall leaderboard