How to Patch Power Apps Combo Box

Do you ever use the patch function with the Power Apps Combo Box control? If not, this Power Apps Tutorial will guide you through how to work with patches using a combo box control to meet your business needs in a variety of scenarios, such as:

  • Power Apps patch combo box value to SharePoint list
  • Power Apps patch combo box selected value
  • Power Apps patch combo box multiple values
  • Power Apps patch combo box to SharePoint person field
  • Power Apps patch combo box to SharePoint lookup column
  • Power Apps patch combo box value to the collection

In Power Apps, there is a function Patch() that is used to add or edit a single record or a list of records from a data source. This allows you to change field values without affecting other properties. The patch can save data from multiple screens at the same time.

Continue reading to learn how to use the Power Apps patch function within the combo box control in the scenarios below.

Power Apps patch combo box value to SharePoint list

Here, we will see how to patch a combo box value to the SharePoint list from Power Apps. For this, we have prepared a SharePoint list named Workers having a title and a choice column (WorkMode) like the one below:

Power Apps patch combo box value to SharePoint list
Power Apps patch combo box value to SharePoint list

We have attached this list to a Power Apps canvas app. On that screen, we will add a text input to insert the title of the worker. Also, add a combo box control using the below expression on the Items property to display the work mode.

Items = Choices(Workers.WorkMode)

Where,

  1. Workers: The name of the SharePoint data source
  2. WorkMode: The name of the SharePoint choice column.
powerapps patch combobox to sharepoint list
Power Apps patch Combo box to SharePoint list

To patch the data from the combo box to the SharePoint list, add a button control to the respective Power Apps screen and inject the below expression on the button’s OnSelect property. So that when the user clicks on the button, the data will save in the SharePoint list.

OnSelect = Patch(Workers, Defaults(Workers),{Title:Txt_WorkerTitle.Text, WorkMode: Cmb_WorkMode.Selected});

Where,

  1. Txt_WorkerTitle: The name of the text input control
  2. Cmb_WorkMode: The name of the combo box control
PowerApps patch combo box value to SharePoint list
PowerApps patch combo box value to SharePoint list

Let’s save and publish the app. Play it in preview mode, then insert data and select a choice from the text inputs and combo box control respectively. (Ex: Smith, Hybrid)

PowerApps patch combo box value to SharePoint list
PowerApps patch combo box value to SharePoint list

Once we click on the Save button, we can see the items got patched in the SharePoint list like below :

PowerApps patch combo box to SharePoint list
PowerApps patch combo box to SharePoint list

This is how to patch a combo box value to the SharePoint list within the Power Apps.

Also read: How to Sort Combo Box Items in Power Apps

Power Apps patch combo box selected value

In the above example, we have seen how to patch a combo box value to the SharePoint list using a button control. Here, we will see how to patch a selected value from the combo box control to the SharePoint list without using a button control.

See also  Code View hyperlink rewritten: Send an email (V2) action Dynamic Content in Power Automate

That means when the user selects any choice from the combo box control it will directly patch to the SharePoint list. To work with this scenario, we are going to use the above example of the SharePoint list as well as the canvas app and the following steps are :

  • On the Power Apps screen, insert the below expression on the combo box’s OnChaneg property.
OnChange = Patch(Workers, Defaults(Workers),{Title:Txt_WorkerTitle.Text, WorkMode: Cmb_WorkMode.Selected});
Power Apps patch combo box selected value
Power Apps patch combo box selected value

Once we insert any data within the text input and select an item from the combo box control, we can see the selected item got patched from the Power Apps combo box control to Power Apps. (Ex: David, WFH).

Patch Combobox selected items to a SharePoint list
Patch Combobox selected items to a SharePoint list

We can see the outcome in the respective SharePoint list below:

Patching combo box selected item to SharePoint list
Patching combo box selected item to SharePoint list

This is how to patch combo box a selected item to the SharePoint list.

Check: Power Apps Cascading Dropdown Control

Power Apps patch combo box multiple values

Because the combo box allows us to select multiple values, we can patch those values to the SharePoint list. In this section, we will see how to patch the multiple values from the combo box control to the SharePoint list.

To implement this, we are going to use the above example of the SharePoint list. On the SharePoint list, set the toggle on the choice column(i.e., WorkMode) to “allow multiple selections.” For this, select the choice column > Column Settings > Edit > More Options > Allow multiple selection > Toggle On > Save.

Power Apps patch combo box multiple values
Power Apps patch combo box multiple values

To select multiple options, enable the ‘Allow Multiple Selections‘ property on the Power Apps screen’s combo box control.

powerapps patch combobox multiple values
powerapps patch combo box multiple values

To patch the multi-selected items from the Power Apps combo box control to the SharePoint list, insert the below expression into the button’s OnSelect property.

OnSelect = Patch(Workers, Defaults(Workers),{Title:Txt_WorkerTitle.Text, WorkMode: Cmb_WorkMode.SelectedItems});
PowerApps patch combo box multiple value to SharePoint list
Power Apps patch combo box multiple values to SharePoint list

Let’s preview it and insert some data in the text input as well as select multiple choices from the combo box control (Ex: WFH, WFO) like below:

Patch Combo box multiple items to a SharePoint list
Patch Combo box multiple items to a SharePoint list

We can see the multi-selected items got patched to the SharePoint list, once the save button was clicked.

Combobox multiple selection patch to SharePoint list
Combobox multiple selection patch to SharePoint list

This is how to patch the multiple selected values from the combo box control to the SharePoint list.

Have a look: How to Reset Power Apps Combo Box

Power Apps patch combo box to SharePoint Person field

Here, we will see how to patch a person field from the Power Apps combo box control to the SharePoint list. That means the user can select an item(Person’s name) from the Power Apps combo box control and patch that item to the SharePoint list. To work with this requirement, the following steps are:

Suppose, we have a SharePoint list named Workers having 2 columns such as Name (Person field), and WorkMode (A choice column) like below:

Power Apps patch combo box to sharepoint person field
Power Apps patch combo box to SharePoint person field

On the Power Apps screen, let’s add a combo box control to display all the employees’ names in the respective organization. For this, add the Office365Users connector to the Power Apps and insert the below expression on the combo box’s Items property.

Items = Office365Users.SearchUser()

Then, set the data layout under the fields (on the right-side properties panel) as below:

  • Primary text: DisplayName
  • Searchfield: Mail
See also  Power Apps Notify() function [How to use with examples]

Now, we can find all the employees’ names within the Power Apps combo box control.

Power Apps patch combo box to the sharepoint person field
Power Apps patch combo box to the SharePoint person field

Add a radio button to allow the user to select their preferred work mode. Insert the following expression into the radio control’s Items property to display the WorkMode options.

Items = Choices(Workers.WorkMode)

Where,

  1. Workers: The name of the SharePoint list
  2. WorkMode: The name of the choice column
Patching a Person Sharepoint Column from a Power Apps Combo Box
Patching a Person Sharepoint Column from a Power Apps Combo Box

To patch the items from the above controls to the SharePoint list, add a button control to the screen and place the patch query below the button’s OnSelect property.

OnSelect = Patch(
    Workers,
    Defaults(Workers),
    {
        Name: {
            '@odata.type': "#Microsoft.Azure.Connectors.SharePoint.SPListExpanderUser",
            Claims: Cmb_Worker.Selected.Mail,
            Department: "",
            DisplayName: Cmb_Worker.Selected.DisplayName,
            Email: Cmb_Worker.Selected.Mail,
            JobTitle: " ",
            Picture: " "
        },
        WorkMode: Rdo_WorkMode.Selected
    }
)

Where Cmb_Worker and Rdo_WorkMode are the names of the combo box and radio control names respectively.

Patch person from Power Apps ComboBox to SharePoint People field
Patch person from Power Apps ComboBox to SharePoint People field

Let’s preview the app and select data from the combo box control as well as the radio control. (Ex: Sonam Subhadarsini, Hybrid).

patch a SharePoint Person Column In Power Apps Combo box
patch a SharePoint Person Column In the Power Apps Combo box

Once the button is clicked, we can see that both items are patched within the SharePoint list.

Patch People Field from Combo Box to SharePoint list
Patch People Field from Combo Box to SharePoint list

This is how to Patch People Field from Combo Box to the SharePoint list.

Check out: Power Apps combo box with Office 365 users

Power Apps patch combo box to SharePoint lookup column

Here, we will see how to patch a combo box item to the SharePoint lookup column. The following steps are:

  • We have created a SharePoint list named Organizer having 3 columns such as Title, ID (Default), and Organizer ID (Number type field) shown below:
Power-Apps-patch combo box to SharePoint lookup column
Power-Apps-patch combo box to SharePoint lookup column
  • Also, we have prepared another SharePoint list named Events having a Title (Default column), and 2 lookup columns.
  • The first lookup column named Organizer used the data from the Title field of the Organizer list(i.e, from the first SharePoint list).
  • The second lookup column named ID_Organizer used the column data of the Organizer ID from the Organizer list.
Power Apps patch combo box to SharePoint list lookup column
Power Apps patch combo box to SharePoint list lookup column
  • By default, another lookup column will be created in the SharePoint list having lookup data from the ID of the Organizer list. i.e., Organizer:ID.
PowerApps patch combo box item to SharePoint lookup column
PowerApps patch combo box item to SharePoint lookup column

This is how the entire Event list looks like below:

How to patch PowerApps combo box item to SharePoint lookup column
How to patch PowerApps combo box item to SharePoint lookup column
  • Next move to the Power Apps to create our app as per the scenarios. On the Power Apps screen, let’s add a text field to insert the event’s title. Again, add a combo box control to display the choices of the organizer. For this, use the below expression on the combo box’s Items property.
Items = Choices(Events.Organizer)
Power Apps patch combo box to SharePoint lookup field
Power Apps patch combo box to SharePoint lookup field
  • To patch the data, add a button control to the screen and insert the below formula on the OnSelect property.
OnSelect = Patch(
    Events,
    Defaults(Events),
    {
        Title: Txt_Event_Title.Text,
        Organizer: {
            '@odata.type': "#Microsoft.Azure.Connectors.SharePoint.SPListExpandedReference",
            Id: Cmb_Organizer.Selected.Id,
            Value: Cmb_Organizer.Selected.Value
        }
    }
)

Where,

  1. Title: The name of the SharePoint column (i.e., From the Event list)
  2. Organizer: The name of the lookup column (i.e., From Event list)
  3. ‘@odata.type’: “#Microsoft.Azure.Connectors.SharePoint.SPListExpandedReference”: While working with patch a lookup column via Power Apps, we need to use this mentioned connector.
  4. Id, Value: The Id and value of the custom column from the Event list
  5. Cmb_Organizer: The name of the combo box control
  6. Txt_Event_Title: The name of the text input control
PowerApps patch combo box to SharePoint lookup field
PowerApps patch combo box to SharePoint lookup field
  • Let’s save the app and play it in preview mode. Insert data in the text input as well as select an item from the combo box control. (Ex- Stock Invest, Microsoft).
Patch a SharePoint LookUp column with a PowerApps combobox
Patch a SharePoint LookUp column with a PowerApps Combobox
  • Once we click on the save button, the data got patched from the combo box control to the SharePoint lookup column as well.
Patch a PowerApps combobox to SharePoint LookUp column
Patch a PowerApps Combobox to the SharePoint LookUp column

This is how to patch a PowerApps Combobox to the SharePoint LookUp column.

See also  SharePoint Online jsom examples (47 Examples)

Check: How to Filter Power Apps Dropdown Control

Power Apps patch combo box value to the collection

Here we will see how to patch a combo box value to a collection within the Power Apps. When the user selects an item from the combo box control and clicks on the button, the desired items get patched within the collection.

Suppose, we have created a collection named CollProject having headers like ProjectName, and Technology on the Power Apps screen’s OnVisible property.

OnVisible = ClearCollect(collProject,{ProjectName: "Project1", Technology: "Python" })

Let’s add a vertical gallery to display the collected data the gallery like below:

Power Apps patch combo box value to collection
Power Apps patch combo box value to the collection

Next, add a text input and a combo box control to the screen. On the combo box’s Items property, insert the below expressions to display the items for Technology.

Items = ["Python", "SharePoint", "Power Apps"]
Power Apps patch combo box value to the collection
Power Apps patch combo box value to the collection

To patch the selected items from the combo box to the collection, add a button control and insert the below expression on the OnSelect property.

OnSelect = Patch(collProject, Defaults(collProject),{ProjectName:Txt_ProjectName.Text,Technology:Cmb_Technology.Selected.Value});Reset(Txt_ProjectName); Reset(Cmb_Technology);

Where Txt_ProjectName and Cmb_Technology are the names of the text input control and combo box control respectively.

Path Combo box item to a Power Apps Collection
Path Combo box item to a Power Apps Collection

Let’s preview the app, then insert a project name in the text input and select technology from the combo box control.

Power Apps patch combo box item to collection
Power Apps patch combo box item to the collection

When we click the Save button, we can see that the item has been patched in both the gallery and the collection, as shown below:

PowerApps patch combo box value to collection
PowerApps patch combo box value to the collection

This is how to do patch a combo box value to a PowerApps collection.

Conclusion

From this Power Apps tutorial, we learned all about how to perform patch function using a Power Apps combo box control based on different types of scenarios such as:

  • Power Apps patch combo box value to SharePoint list
  • Power Apps patch combo box multiple values
  • Power Apps patch combo box selected value
  • Power Apps patch combo box to SharePoint person field
  • Power Apps patch combo box to SharePoint lookup column
  • Power Apps patch combo box value to the collection

Also, have a look at the below Power Apps tutorials:

>