cancel
Showing results for 
Search instead for 
Did you mean: 
Reply
NickDF88
Regular Visitor

Form Datafield Person to User Data

I have a Powerapp linked to a Sharepoint list. It's really basic. It's for users to submit praise for a colleague. They select them from a Person field and write their comments in a Multi Line Text field and submit to the List.

 

When a user selects the Person they're nominating - I want to store the selected person and retrieve (from O365 User Directory) their Manager, e-mail address etc.

 

It must be simple... but can't crack it!

1 REPLY 1
martijnA
Helper I
Helper I

That should be simple enough.

I'm going to assume a scenario where

  • we pick people from a combobox lets call that combobox "cbox_PeoplePicker"
  • we enter the comments in a whatever type you please and call that "inp_Comments"
  • we call the SP list "list_praise" and it will have the following columns
    • Employee
    • Manager
    • Comments
    • Title (because we simply have to have that)
  • we have a button to submit called "btn_Submit"

 

The only thing needed is this code on that submit button

 

 

Patch(list_praise, Defaults(list_praise),
    {
    Title: "Praise Given",
    Employee:   {'@odata.type': "#Microsoft.Azure.Connectors.SharePoint.SPListExpandedReference", Claims: "i:0#.f|membership|" & cbox_PeoplePicker.Selected.mail,
                Department: "",
                DisplayName: "",
                Email: cbox_PeoplePicker.Selected.mail,
                JobTitle: "",
                Picture: ""},

    Manager:    {'@odata.type': "#Microsoft.Azure.Connectors.SharePoint.SPListExpandedReference", Claims: "i:0#.f|membership|" & 
                Office365Users.ManagerV2(cbox_PeoplePicker.Selected.mail).mail
                Department: "",
                DisplayName: "",
                Email: Office365Users.ManagerV2(cbox_PeoplePicker.Selected.mail).mail
                JobTitle: "",
                Picture: ""},
    Comments:   inp_Comments.Text
    })

    //; code to reset some of your input fields

 

 

Alter this scenario to whatever your inputs are called and you should be good to go!

 

Did this answer help you in any way? Consider to "Accept as Solution" and give a "Thumbs Up"

Helpful resources

Announcements
October Events

Mark Your Calendars

So many events that are happening this month - don't miss out!

Ignite 2022

WHAT’S NEXT AT MICROSOFT IGNITE 2022

Explore the latest innovations, learn from product experts and partners, level up your skillset, and create connections from around the world.

Power Apps Africa Challenge 2022

Power Apps Africa Challenge

Your chance to join an engaging competition of Power Platform enthusiasts.

Users online (2,980)