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
Power Apps News & Annoucements carousel

Power Apps News & Announcements

Keep up to date with current events and community announcements in the Power Apps community.

Community Call Conversations

Introducing the Community Calls Conversations

A great place where you can stay up to date with community calls and interact with the speakers.

Power Apps Community Blog Carousel

Power Apps Community Blog

Check out the latest Community Blog from the community!

Top Solution Authors
Top Kudoed Authors
Users online (3,839)