cancel
Showing results for 
Search instead for 
Did you mean: 
Reply
Victoria
Kudo Kingpin
Kudo Kingpin

Patching a dropdown to a SharePoint list

I have an app that recognizes the logged in user, allowing people to book their own desks.
user screen.png

This works fine. I am patching on the 'Book' button to update a master list called 'DeskRequests' that holds all the bookings. 

 

 

Patch(
    DeskRequests,
    Gallery2_1.Selected,
    {
        Status: {
            Value: "Booked",
            '@odata.type': "#Microsoft.Azure.Connectors.SharePoint.SPListExpandedReference"
        },
        ReservedBy: {
            '@odata.type': "#Microsoft.Azure.Connectors.SharePoint.SPListExpandedReference",
            Claims: "i:0#.f|membership|" & Lower(User().Email),
            Department: "",
            DisplayName: "",
            Email: User().Email,
            JobTitle: ".",
            Picture: "."
        }
    }
)

 

 


Now I'm trying to create an admin version of the same screen, where managers can book on behalf of other users.
I have added a drop down to display the users (and linked this to a text column in a new list, called 'DeskUsers'). 

admin screen.png

 

How do I patch the selected person in the dropdown to my 'DeskRequests' list (ReservedBy column), rather than the logged in user?

ckjjdo.png

 

Any help would be much appreciated. Thanks.

1 ACCEPTED SOLUTION

Accepted Solutions

Hi @Victoria

Do you want to patch the dropdown selected user to ReservedBy column?

Could you please tell me how you set the Items property of the people picker?

 

Actually, it is easy to achieve this, however it depends on how you set the Items property of the dropdown field.

Here I just assume that you set the Items with a single Text column with unique user names as below:

DeskUsers.UserName //Here UserName is the Text column in DeskUsers

Then you should modify your patch formula as below:

Patch(
    DeskRequests,
    Gallery2_1.Selected,
    {
        Status: {
            Value: "Booked",
            '@odata.type': "#Microsoft.Azure.Connectors.SharePoint.SPListExpandedReference"
        },
        ReservedBy: {
            '@odata.type': "#Microsoft.Azure.Connectors.SharePoint.SPListExpandedReference",
            Claims: "i:0#.f|membership|" & First(Office365Users.SearchUserV2({searchTerm: Dropdown.Selected.UserName}).value).DisplayName,
            Department: "",
            DisplayName: "",
            Email: First(Office365Users.SearchUserV2({searchTerm: Dropdown.Selected.UserName}).value)..Mail,
            JobTitle: ".",
            Picture: "."
        }
)

Here is the key to this issue that you should use Office365Users() function to retrieve the user based on selected user name from the dropdown:

First(Office365Users.SearchUserV2({searchTerm: Dropdown.Selected.UserName}).value).DisplayName
Best Regards,
Qi

View solution in original post

4 REPLIES 4
Drrickryp
Super User
Super User

@Victoria 

To simplify things, consider using a different screen and form when an admin checks in.

It could be a modification of the form you are already using.

Thanks for replying. 
I can confirm I am using different screens, a user version and an admin version, so the patch in the user screen can stay as it is.
I'd like to know how to patch the admin screen, so that the information from the dropdown field (not a form) can be captured instead of the logged in user. 

 

Hi @Victoria

Do you want to patch the dropdown selected user to ReservedBy column?

Could you please tell me how you set the Items property of the people picker?

 

Actually, it is easy to achieve this, however it depends on how you set the Items property of the dropdown field.

Here I just assume that you set the Items with a single Text column with unique user names as below:

DeskUsers.UserName //Here UserName is the Text column in DeskUsers

Then you should modify your patch formula as below:

Patch(
    DeskRequests,
    Gallery2_1.Selected,
    {
        Status: {
            Value: "Booked",
            '@odata.type': "#Microsoft.Azure.Connectors.SharePoint.SPListExpandedReference"
        },
        ReservedBy: {
            '@odata.type': "#Microsoft.Azure.Connectors.SharePoint.SPListExpandedReference",
            Claims: "i:0#.f|membership|" & First(Office365Users.SearchUserV2({searchTerm: Dropdown.Selected.UserName}).value).DisplayName,
            Department: "",
            DisplayName: "",
            Email: First(Office365Users.SearchUserV2({searchTerm: Dropdown.Selected.UserName}).value)..Mail,
            JobTitle: ".",
            Picture: "."
        }
)

Here is the key to this issue that you should use Office365Users() function to retrieve the user based on selected user name from the dropdown:

First(Office365Users.SearchUserV2({searchTerm: Dropdown.Selected.UserName}).value).DisplayName
Best Regards,
Qi
Victoria
Kudo Kingpin
Kudo Kingpin

Thanks for your help. That worked a treat. 

Helpful resources

Announcements
Power Platform Call June 2022 768x460.png

Power Platform Community Call

Join us for the next call on August 17, 2022 at 8am PDT.

Power Platform Conf 2022 768x460.jpg

Join us for Microsoft Power Platform Conference

The first Microsoft-sponsored Power Platform Conference is coming in September. 100+ speakers, 150+ sessions, and what's new and next for Power Platform.

Users online (1,944)