Power Apps Button OnSelect [Complete Tutorial]

In this PowerApps Tutorial, We will discuss what does the mean of Power Apps Button OnSelect and how a PowerApps user works with the PowerApps button onselect functions.

Also, by taking some simple scenarios, We will cover these below topics as:

  • Power Apps button onselect
  • Power Apps button onselect functions
  • Power Apps button onselect background color
  • PowerApps button onselect color
  • PowerApps onselect disable button
  • PowerApps button onselect run flow
  • PowerApps button onselect multiple actions
  • PowerApps button onselect set field value
  • PowerApps button onselect submit form
  • PowerApps button onselect open url
  • PowerApps button onselect change screen
  • PowerApps button onselect go to screen
  • PowerApps button onselect change text
  • PowerApps button onselect if statement
  • PowerApps button onselect alert
  • Power Apps button onselect close app
  • Power Apps Exit Function
  • Power Apps button onselect change dropdown
  • Power Apps call button onselect
  • PowerApps cancel button onselect
  • PowerApps button onselect send email
  • Power Apps button onselect hyperlink
  • Power Apps button onselect update sharepoint list
  • Power Apps button onselect patch
  • Power Apps radio button onselect

Power Apps button onselect

  • PowerApps Button is an input control and Power Apps Button OnSelect is a property of the button input.
  • PowerApps Button OnSelect is an event that is basically used in PowerApps. This Button OnSelect property helps to do some actions when a user clicks on it.
  • To trigger an action, You can insert your code on the Button’s OnSelect property. If you will not specify any code to this OnSelect property, then the button will not work.

Read: Power Apps Choices Function

Power Apps button onselect functions

Power Apps Button is an input control that helps to user click to do some actions in the app. That means, when the user will click on the button, then it will do the event depends upon you have specified the code.

PowerApps button properties

Below represents some important properties of Power Apps button control:

  1. Text = When the PowerApps user clicks the button, it helps to display the text that appears on a control.
  2. OnSelect = When the PowerApps user clicks the button, it specifies how the app responds.
  3. BorderColor = It defines the color of the control’s border.
  4. Color = It specifies the text control in a control.
  5. DisplayMode = It specifies whether the control allows user input (Edit), View, or is disabled.
  6. Fill = It defines the background color of a control.
  7. Pressed = When the button is pressed, the value will be true otherwise it will be false.
  8. PressedColor = When the user clicks the button input, then the text color will change.
  9. PressedFill = When the user clicks the button input, then the background color will change.
  10. Size = Specifies the font size of the text that appears on the control.
  11. Visible = It specifies whether the control appears or is hidden.
  12. Width = The distance between a control’s left and right edges.

PowerApps button onselect background color

  • Suppose you want to change the color of the button when the user will press it.
  • In that case, PowerApps provides a Button property called PressedColor that specifies the font color of the button input. There is another button property called PressedFill for the background color of the button input.
  • Here what I want to do is, the user can use the button as a toggle. That means when the user will press the button anytime, it will change the color of the button itself.
  • In this case, you can use the context variable that is toggled in the OnSelect handler of the button. You can refer this below formulas for your reference:
Button1.OnSelect = UpdateContext({ toggleValue: !toggleValue })
Button1.Color = If(toggleValue, Color.Grey, Color.Green)
Button1.Fill = If(toggleValue, Color.Blue, Color.Red)

Where,

  1. toggleValue = Variable name
  2. Color, Fill = These are the button properties

Power Apps button onselect color

Here we will see how we can work with the PowerApps button onselect color.

  • There are two buttons in the app named Add to Cart and Click to Buy. Now what I want to do is, When the user selects the first button (Add to Cart), then the other button color will change to grey color. But at the same time, the user can select only one button.
  • To do so, follow these below things:
  1. At first, Select the first Button control (Add to Cart) and apply this below formula on its OnSelect Property as:
OnSelect = UpdateContext(
    {
        OneClicked: true,
        TwoClicked: false
    }
)

Where,

OneClicked, TwoClicked = These are the context variable name that I specified the boolean values true and false. You can enter any context variable names.

PowerApps button onselect color
Power Apps Button OnSelect

2. Similarly, Select the second Button input and apply this below formula on its OnSelect property as:

OnSelect = UpdateContext(
    {
        TwoClicked: true,
        OneClicked: false
    }
)

Here, I have specified the TwoClicked variable value as true and other one is false.

3. Next, select the Add to Cart button and set its Fill property to these below formula:

Fill = If(
    OneClicked,
    Blue,
    DimGrey
)

Where,

OneClicked = Specified Context variable name

Power Apps button onselect color
Power Apps Button OnSelect examples

4. Similarly, Select the second button (Click to Buy) and apply this below formula on it’s Fill property as:

Fill = If(
    TwoClicked,
    Blue,
    DimGrey
)

5. Now Save and Preview the app. When you will click the first button (Add to Button), then it will change the color to Blue and and the other second button will display with DimGrey color. Similarly, When you will click on the second button (Click to Buy), then the second button will appear with Blue color and the first button will DimGrey color. At the same time, you can only press one button control.

button onselect color in PowerApps
Power Apps Button OnSelect

PowerApps onselect disable button

Suppose you want to disable a button when a PowerApps user clicks on it. Follow the below scenario.

  • On the PowerApps screen, I have a Button input named Hit and Get it Disable. Now I want to disable this button when a user pressed on it.
  • Select the Button and apply this below code on its OnSelect property as:
OnSelect = UpdateContext ({DisplayMode: DisplayMode.Disabled})

Where,

  1. DisplayMode = Context Variable Name
  2. DisplayMode.Disabled = This is the Button’s Display mode property where I have specified it to disable mode
PowerApps onselect disable button
PowerApps onselect disable button
  • Again go to the DisplayMode property of the button input control and set this below code:
DisplayMode = DisplayMode

Where,

DisplayMode = Specified context variable name

Power Apps onselect disable button
PowerApps onselect disable button
  • Now Save and Publish the app. Reopen the app again and press the button input. Once you will press it, then the button will disable as shown in the below screenshot. (Please make a note that, this will work only one time in the app. That means the user can only press the button for one time).
How to use PowerApps onselect disable button
PowerApps onselect disable button

This is how to disable button using Power Apps onselect.

PowerApps button onselect run flow

In this example, I will discuss how we can run a PowerAutomate or flow just by clicking a PowerApps Button input.

  • PowerApps is such a great thing that allows initiating a Power Automate or Microsoft Flow. It helps to get the information that is already provided in the PowerApps form.
  • In the below screenshot, you can see there are three text input controls named Title, Employee Profile, and Salary. Also, one-button input is there named Create Item that will help you to run your flow.
  • Basically here I will create an item in the SharePoint custom list on the button click event. I want to create the item using the MS Flow that will run on the Button press. Follow these below steps to do so.
PowerApps button onselect run flow
PowerApps button onselect run flow
  1. On the PowerApps screen, Go to the Action section -> Power Automate -> Click on the + Create a new flow as shown in the below screenshot.
PowerApps button on select run flow
PowerApps button onselect run flow example

2. Now it will open with the below page. Go to My flows -> + New flow -> Instant cloud flow.

Power Apps button onselect run flow
PowerApps button onselect run flow

3. Enter the flow name that you want to give and choose PowerApps to trigger the flow. Click to Create button.

Power Apps button onselect run flows
How to run a flow on PowerApps button onselect

4. You can see the below flow screen will appear. Click on the + New step to add a new action.

PowerApps button onselect run flows
run a flow on PowerApps button onselect

5. Hence we want to create a new item in the SharePoint custom list, So we need to the action as “Create item“. Then enter these below fields:

  • Site Address: This is the most important field that you need to specify. Enter or select the SharePoint Site address.
  • List Name: This is also an important field where you need to specify the SharePoint custom list name to store the data.
  • Title: Select the Title field and click on the “Ask in PowerApps” from the Dynamic content. Then you can see the title column will come from the PowerApps.
  • Employee Profile: Select the Employee Profile field and click on the “Ask in PowerApps” from the Dynamic content. Then you can see the employee profile column will come from the PowerApps.
  • Salary: Select the Salary field and click on the “Ask in PowerApps” from the Dynamic content. Then you can see the salary column will come from the PowerApps.
how to use PowerApps button onselect run flow
Steps to run a flow on PowerApps button onselect

6. Next, Save the flow and go back to the PowerApps app. Here you can see the new flow will appear in the Flow data window. Click on it. Once you will click the flow, you can see the new flow name will be integrated with the button’s OnSelect property.

Use PowerApps button onselect run flow
powerapps button onselect start flow

7. Select the Button input (Create Item) and apply this below formula on its OnSelect property as:

Where,

OnSelect = CreateItemonButtonOnSelect.Run(txtEmpProfile,txtSalary,txtTitle)

txtEmpProfile,txtSalary,txtTitle = Text input control names

Use Power Apps button onselect run flow
powerapps button onselect start flow

8. Now Save and Publish the app. Reopen the app again, enter these below fields and then click on the button (Create Item). Here the button will trigger and run the flow. Then the flow will succeed and the new item will create in the existing SharePoint list.

how to use Power Apps button onselect run flow
start flow on powerapps button onselect

9. At last, go to the specific SharePoint list (Employee Info) and there the new item has been created as like the below screenshot.

how to PowerApps run flow on button onselect
powerapps button onselect start flow

This is how to start a flow or Power Automate on PowerApps button onselect.

Power Apps button onselect multiple actions

Let us assume there is a PowerApps Button input control. I would like to do some multiple actions when the Power Apps user clicks on the single button.

  • In the below screenshot, I have an Edit form that contains SharePoint list data (Travel Details). Now, I want to perform two actions when the user will press the Submit button. Those actions are:
  1. The form data will submit in the SharePoint List (Travel Details).
  2. After submitting the data, it will navigate to another screen (Thank You screen).

NOTE:

First of all, you need to know one important thing is, When you are going to perform multiple actions on the select of Button, you can separate each action by a Semicolon (;).
  • To do this requirement, You can apply this below code on Submit Button’s OnSelect property as:
OnSelect = SubmitForm(Form1); Navigate(Screen2);

Where,

  1. Form1 = Edit form name
  2. Screen 2 = Thank you screen. After submitting the form, it will navigate to this specified screen. You need to design this page as a Thank You screen.
PowerApps button onselect multiple actions
PowerApps button onselect multiple actions
  • Now save and preview the app. Enter all the field values in the form and click on the submit button. Then you can see the data will submit in the existing SharePoint list (Travel Details) and at the same time, it will appear with a Thank you screen (Screen2).

PowerApps button onselect set field value

Do you ever set the field value on the select of PowerApps Button? If No, then below represents a simple scenario that you can understand easily that how to use it.

  • I have a SharePoint list named Project Details. This list has a Choice column named Project Status. This choice column has these many values as:
    • Submitted
    • Approved
    • Rejected
    • Pending
  • On the PowerApps screen, I have an Edit form with the SharePoint List data connection. That means, all the SharePoint fields are retrieved from the specified SharePoint list (Project Details).
  • Also, there is a Button input named Closed that will help you to perform the below requirement.
PowerApps button onselect set field value
Power Apps button onselect set field value
  • Now what I want to do is, I want to change the Choice field value within the Edit form to Pending when a PowerApps user clicks the Close Button. To do so, follow these below things.
  • Go to the Screen’s OnVisible property and apply this below code:
OnVisible = NewForm(Form2);Set(ChoiceVar, Blank());

Where,

ChoiceVar = Variable name

PowerApps button onselect set field values
PowerApps button onselect set field value
  • Now select the Close button and set this below formula on its OnSelect property as:
OnSelect = Set(ChoiceVar, {Value: "Pending"})

Where,

  1. ChoiceVar = Specified variable name
  2. Value: “Pending” = Here, I have specified the value as Pending
button onselect set field value in PowerApps
Power pps button onselect set field value
  • Next, Select the Project Status ComboBox control and apply this below formula on its DefaultSelectedItems property as:
DefaultSelectedItems = If(
    !IsBlank(ChoiceVar),
    ChoiceVar,
    Parent.Default
)

Refer to the below screenshot.

button onselect set field values in PowerApps
Power Apps button onselect set field value
  • Save and Publish the app. Reopen the app again. Once you will click on the Close button, then the Project Status field will change to Pending as shown in the below screenshot.
How to use PowerApps button onselect set field values
set field value on PowerApps button onselect

This is how to set field value on PowerApps button onselect.

PowerApps button onselect submit form

  • As you know the most popular and common thing in the PowerApps is, Submitting the PowerApps Form on the Button’s select. That means, When a user will press the button, then the form will submit.
  • To save any changes in a Form control to the data source, you can use the PowerApps SubmitForm function in the Button’s OnSelect property. Let’s take a simple scenario.
  • Suppose there is an Edit form in the PowerApps app. The data fields are retrieved from the SharePoint List Data source. Now what I would like to do is, the PowerApps user will enter all the field data and save the data in the SharePoint list (data source) through a Button OnSelect.
  • To do so, You can select the Button input (Submit) apply this below code on its OnSelect property as:
OnSelect = SubmitForm(Form1)

Where,

  1. SubmitForm = This is the PowerApps function that helps to submit the form
  2. Form1 = This is the edit form name
  • You can refer to the below screenshot. You can select the OnSelect property directly through the formula bar and as well as from the Button’s Advanced property.
PowerApps button onselect submit form
PowerApps button onselect submit form

Example:

Let’s take a simple scenario So that you can understand it easily. In this example, I would like to change a Label control after the button pressed. To do this, follow the below processes.

  1. I have to insert a Button input and a Label input control on the app. Rename the Button input to Click me.
  2. Select the Button input (Click me) and apply this below code on its OnSelect property as:
OnSelect = UpdateContext({SubmitStatus:"Completed"})

Where,

  • SubmitStatus = Context variable name
  • “Completed” = It is the string that I want to display in the label control when a user will press the button
Power Apps button onselect submit form
PowerApps button onselect submit form

3. Next, Select the Label control and set this below variable o its Text property as:

Text = SubmitStatus

SubmitStatus = Specified Context Variable Name

onselect submit form using PowerApps button
submit form on powerapps button onselect

4. Under the OnVisible property of the Screen, apply this below formula:

OnVisible = UpdateContext({SubmitStatus:""})
onselect submit form PowerApps button
How to submit form on powerapps button onselect

5. Now Save and Preview the app. Click the button control. You can see the text “Completed” will appear in the label control as shown in the below screenshot.

PowerApps button on select submit form
How to submit form on powerapps button onselect

This is how to submit form on PowerApps button onselect.

PowerApps button onselect open URL or PowerApps button onselect hyperlink

It’s really an interesting thing that when a user will click the button input, it will open a Hyperlink or URL of a specific website. Refer to the below simple example.

  • There is a Button control named Hit Me. I want to link a URL to the button input so that when the user clicks on the button, it will go to the specified website.
  • Select the Button input and apply this below formula on its OnSelect property as:
OnSelect = Launch("https://www.tsinfotechnologies.com/")

Where,

  1. Launch = This is one of the PowerApps function that helps to launch the specified webpage
  2. “https://www.tsinfotechnologies.com/” = You need to specify the URL of the WebSite that you want to appear on the Button on select. Here you need to make sure that the Website URL should be present inside the semicolon (;)
PowerApps button onselect open URL
PowerApps button onselect open URL
  • Save and Preview the app. Press the button input (Hit Me). You can see it will navigate to the specified URL. As I have specified ta company website, So in my case, that specified company website is opening.
  • To learn more details about the PowerApps button on select open URL, you can refer to this article: PowerApps Navigate to another screen

PowerApps button onselect change text

Here we will see how to work with the PowerApps button on select change text. Let’s take one simple scenario.

  • On the app, I have a Button input control named Show Me. Now what I would like to do is, when the user will click this button (Show Me), then the “Show Me” button text will change from “Show Me” to “Hide Me” and vice versa.
  • This means, When the user will click the button “Hide Me“, then the button text again will change to “Show Me“.
  • You can do this requirement by using the PowerApps UpdateContext function. Select the Button input and apply this below formula on its OnSelect property as:
OnSelect = UpdateContext({hide:!hide})

Where,

  1. hide = Context Variable name
  2. !hide = This is the value given to the variable
PowerApps button onselect change text
PowerApps button onselect change text
  • Next, Set this below code on Button’s Text property as:
Text = If(
    hide,
    "Show Me",
    "Hide Me"
)

The above code specifies if the button value is “hide“, then the text will appear with “Show Me” otherwise it will appear with “Hide Me“.

Power Apps button onselect change text
Power Apps button onselect change text
  • Now Save and Preview the app. Click the Button (the text will be Hide Me), then the button text will change to Show Me. Again when you will click on the Show Me, then the text will change to Hide Me as like the below screenshot.
PowerApps button onselect change texts
PowerApps button onselect change text
  • Rather than this, if you want to design more, then you can use many properties of various controls and labels on the screen. It may be to disable the button control or to change its color.
  • To disable the button input, you can set its DisplayMode property to this below formula as:
DisplayMode = If(hide,Edit,View)
  • Also, if you want to change the color, then you can easily use the Fill property to this below code as:
Fill = If(hide,Red,Green)

This is how to change text in PowerApps button onselect.

PowerApps button onselect if statement

Want to work with the PowerApps If Statement on PowerApps Button OnSelect? Refer to this below scenario.

  • On the Powerapps form, there is a Yes/No field (PowerApps Toggle control) that is retrieved from a SharePoint list. Here what I want to do is, If the toggle control value is Yes, then it will navigate to the welcome screen, otherwise it will navigate to a warning screen. Both the condition should apply to the Powerapps Button control.
  • Select the Button input (Submit) and apply this below formula on its OnSelect property as:
OnSelect = If(
    DataCardValue18.Value = true,
    Navigate(
        Screen3,
        ScreenTransition.Fade
    ),
    Navigate(
        Screen4,
        ScreenTransition.Fade
    )
)

Where,

  1. DataCardValue18 = Yes/No toggle control that is set to true
  2. Screen3 = This is another screen (Welcome screen)
  3. Screen4 = This is the warning screen that will appear in the false case.
PowerApps button onselect if statement
PowerApps button onselect if statement
  • Now Save and Preview (F5) the app. Enter the fields and make the toggle value (Received) to Yes and click on the Submit button.
  • Once you click on the button, at the same time it will navigate to the welcome screen as shown in the below screenshot.
PowerApps button onselect if statements
Power Apps button onselect if statement
  • Similarly, Make the toggle value (Received) to No and then click on the Submit button. At the same time, you will see a warning screen as shown below.
OnSelect if statements in Powerapps
PowerApps button onselect if statement

This is an example of Power Apps button onselect if statement.

PowerApps button onselect alert

  • Before doing this, First of all, you should know what does the meaning of the PowerApps button onselect alert? Also, how a PowerApps user can use it?
  • PowerApps button onselect alert means, When a user will press the button, then some notification will display on the PowerApps Screen as per the user specification. PowerApps Notification means, it may be a Successful message, an Information message, a Warning message, or an Error message.
  • To make it more simple, you can refer to these below two PowerApps articles:
  1. How to use PowerApps notify function
  2. PowerApps Popup message Box with Examples

PowerApps button onselect close app

  • Many of the PowerApps Users want to close the app by using the Button control. It also helps the user with time-saving. As simple as when the user clicks on the button, then the app will close automatically.
  • For this, users do not need to close the running app by using any Cancel icon or anything. It will happen by itself once you press the button.
  • For this thing, You can use the PowerApps Exit function. Now you should get an idea that what is this Exit function in PowerApps and its syntax.

PowerApps Exit Function

  • PowerApps Exit function helps to exit, stop, or close the running app, and also signs out the current user. Then the user can open another app.
  • You can use the Signout argument to sign out the current user from the PowerApps app.

PowerApps Exit Function Syntax

  • Below represents the syntax of PowerApps Exit Function as:
Exit( [Signout] )

Where,

Signout = This is optional. Here the default value is false. If the default boolean value is false, then the user remains signed in and if the default boolean value is true, then the user will sign out from the PowerApps.

PowerApps Exit Function Example

Refer to this below Table that how you can use the PowerApps Exit Function.

Formula Description
Exit() This helps to exit the current app and leaves the user signed in. The user is returned to the list of apps.
Exit( true ) This helps to exit the current app and the user is signed out. The user will need to sign back in with their credentials before running an app.

Now coming to this point “PowerApps button onselect close app”, Insert a Button input and apply this below formula on its OnSelect property as:

OnSelect = Exit()

PowerApps button onselect change dropdown

In this scenario, We will see how to work with PowerApps DropDown change value using the PowerApps button on select. Simply we can say when the user will click on the button, then the dropdown value will change to the user given value.

  • The below screenshot represents a PowerApps DropDown control and a Button input (Hit Me). The Dropdown control has these many values on its Items property as:
Items = ["IT","HR","FINANCE","MANAGER","ADMIN","MARKETING","WAREHOUSE","VISITORS"]
PowerApps button onselect change dropdown
PowerApps button onselect change dropdown
  • Next, Select the Dropdown control and set this below formula on its OnChange property as:
OnChange = Set(
    varDDValue,
    Dropdown1.Selected.Value
)

Where,

  1. varDDValue = Variable name
  2. Dropdown1 = Dropdown control name
Power Apps button onselect change dropdown
Power Apps button onselect change dropdown
  • Select the Button input (Hit Me) and apply this below formula on its OnSelect property as:
OnSelect = Set(varDDValue, "ADMIN")

Where,

  1. varDDValue = Variable Name
  2. “ADMIN” = Here you need to specify the value that you want to display in the Dropdown control. This is must be a value that should be present in the dropdown Items property
PowerApps button onselect change dropdown value
change dropdown on PowerApps button onselect
  • At last, Select the Dropdow control and set its Default property to the specified variable name.
Default = varDDValue
how to change dropdown powerapps button click
how to change dropdown powerapps button click
  • Now Save and Preview the app. Once you will press the button (Hit Me), then you can see the dropdown value will change from IT to ADMIN as in the below screenshot.
PowerApps button onselect change dropdown control
how to change dropdown powerapps button click

This is how to change dropdown powerapps button click.

PowerApps button onselect change screen and PowerApps button onselect go to screen

  • You can easily use the PowerApps Button OnSelect Change Screen by using the PowerApps Navigate command. Here the “PowerApps button onselect change screen” and “PowerApps button onselect go to screen” both are having the same meaning.
  • You can enter the Navigate command on Button’s OnSelect property and it will navigate the screen that you wish to move to.
  • The switching between screens occurs by using the Navigate function with the help of the PowerApps Button’s OnSelect property.
  • Refer to this article that how a PowerApps user can use it: PowerApps Navigate to another screen

PowerApps call button onselect

In this topic, We will see how to work with PowerApps call button onselect.

  • On the PowerApps screen, I have a Text input control and a Button input (Enter). Now what I would like to do is, When the PowerApps user enters some text into the Text Input control and Presses Enter, then I want the OnSelect() on the Button to be triggered.
  • To do this, you can select the Text input control and apply this below formula on its OnChange property as:
OnChange = Select(Button8)

Where,

Button8 = Button input Name

PowerApps call button onselect
PowerApps call button onselect

PowerApps cancel button onselect

Do you want to cancel the PowerApps form on the button click? Not only you can cancel, but also you can perform the action like Close, Save, Edit, etc. on the press of the button input.

  • In the below screenshot, you can see there are three different button inputs named Save, Cancel, and Edit. What I want to do is,
    • When the user will click on the Save button, then the form will save in the specific data source.
    • When the user will click on the Cancel button, then it doesn’t save any changes made to the form.
    • When the user will click on the Edit button, then it allows the contents of the form to be Edited if it had been open in view mode
PowerApps cancel button onselect
PowerApps cancel button onselect

SAVE the Form:

As usual to save the form, Select the Save button and set its OnSelect property as:

OnSelect = SubmitForm(SharePointForm1); RequestHide()

Where,

  • SharePointForm1 = This specifies the edit form in the app
  • RequestHide() = This is an optional. If you want to hide the custom form, then you can use this function.

CANCEL the Form:

To cancel the form, Select the Cancel button and set its OnSelect property as:

OnSelect = ResetForm(SharePointForm1)

EDIT the Form:

To edit the form, apply this below code on Edit button’s OnSelect property as:

OnSelect = EditForm(SharePointForm1)

PowerApps button onselect send email

Do you ever try to send an Email to a particular user(s) by using only press the PowerApps button input control? It’s really an interesting thing to do in PowerApps.

If you never try this before, then please refer to this below article that describes details about How to send an Email on Button click in PowerApps.

PowerApps send email on submit

PowerApps button onselect update sharepoint list

Here we will discuss how to update a SharePoint List using the PowerApps Button OnSelect. Lets do a simple scenario.

  • On the PowerApps screen, I have an Edit form and the fields are retrieved from a SharePoint List Data source (Project Details). In the SharePoint list, there is a Choice column named Project Status that has these below values:
    • Submitted
    • Approved
    • Rejected
  • On the screen, there are three buttons named APPROVED, REJECTED, and SAVE. Now what I would like to do is, I want to update the corresponding options according to the selected button.
  • This means when I will click on the APPROVED button, then it will update the approved value in the Project Status combo box. Similarly, When I will click on the REJECTED button, then it will update it to rejected value. The form looks like the below screenshot.
PowerApps button onselect update sharepoint list
PowerApps button onselect update sharepoint list
  • To do so, you need to follow these below processes:
  1. Select the Project Status combo box control and set its DefaultSelectedItems property to a variable as:
DefaultSeectedItems = var1

Where,

  • var1 = Variable name

2. Select the APPROVED button and apply this below code on its OnSelect property as:

OnSelect = Set(
    var1,
    Filter(
        Choices('Project Details'.'Project Status'),
        Value = "Approved"
    )
)

Where,

  • ‘Project Details’ = SharePoint list name
  • ‘Project Status’ = SharePoint Choice column. You need to specify the value as Approved
Power Apps button onselect update sharepoint list
Power Apps button onselect update sharepoint list

3. Similarly, REJECTED button and apply this below code on its OnSelect property as:

Onselect = Set(
    var1,
    Filter(
        Choices('Project Details'.'Project Status'),
        Value = "Rejected"
    )
)

4. To save the form, you can apply this below code on Button’s (SAVE) OnSelect property as:

Onselect = SubmitForm(EditForm)

Where,

  • EditForm = Edit form name

5. Save and Publish the app. Reopen the app again and enter all the field values. When you will click on the APPROVED button, then the Approved value will update in the Project Status field as shown below. Similarly, if you will click on the REJECTED button, then the status value will update to Rejected. At last, When you will click on the SAVE button, then the form will save into the SharePoint list.

PowerApps button onselect update in sharepoint list
Power Apps button onselect update sharepoint list

PowerApps button onselect patch

  • If you are a PowerApps user, then you must have knowledge about what is the Patch function in PowerApps. In shorts, PowerApps Patch Function is used to modify single or multiple records of a data source.
  • Now the point is, Suppose you want to modify or update a record in the existing SharePoint List and that to be using a Button on select. Then in this case you can use the PowerApps Patch function.
  • To learn more details about the PowerApps button onselect patch, refer to the below article:

How to update SharePoint List Item on button click in PowerApps

PowerApps radio button onselect

  • When you are working with the PowerApps Radio Button control, you can see there will be appearing with the whole set of radio buttons on the screen.
  • At the same time, you might be thinking that you only can change the OnSelect function of the whole set of radio buttons. But not like that the way you think.
  • You can change each radio button to a different OnSelect function on the PowerApps screen.
  • I have a Radio button control that has below items on its Items property as:
Items = ["Approved","Rejected"]
  • Now select the Radio Button control and apply this below formula on its OnSelect property as:
OnSelect = If(
    Radio1.Selected.Value = "Approved",
    Set(
        varRadio,
        "One"
    ),
    If(
        Radio1.Selected.Value = "Rejected",
        Set(
            varRadio,
            "Two"
        )
    )
)

Where,

  1. Radio1 = Radio button control name
  2. varRadio = Variable Name
  3. “One”, “Two” = If the user will choose the value as “Approved”, then it will appear with “One” otherwise “Two”.
PowerApps radio button onselect
PowerApps radio button onselect
  • To check the button control result, you can insert a Label control and set the specified variable on its Text property as:
Text = varRadio
Power Apps radio button onselect
PowerApps radio button onselect example
  • Save and Preview the app. Select one choice as Approved from the radio button control. You can see the label control will display the value as One.
  • Similarly, When you will select the choice value as Rejected, then the label control will display with Two value.
  • If you are interested to learn more about the PowerApps Radio Button control, then refer to this article: Microsoft PowerApps Radio Button Example

Also, you may like these below PowerApps tutorials:

In this PowerApps Tutorial, We discussed what does the mean of PowerApps Button OnSelect and how a PowerApps user works with the PowerApps button onselect functions.

Also, by taking some simple scenarios, We covered these below topics as:

  • PowerApps button onselect
  • PowerApps button onselect functions
  • PowerApps button onselect background color
  • PowerApps button onselect color
  • PowerApps onselect disable button
  • PowerApps button onselect run flow
  • PowerApps button onselect multiple actions
  • PowerApps button onselect set field value
  • PowerApps button onselect submit form
  • PowerApps button onselect open url
  • PowerApps button onselect change screen
  • PowerApps button onselect go to screen
  • PowerApps button onselect change text
  • PowerApps button onselect if statement
  • PowerApps button onselect alert
  • PowerApps button onselect close app
  • PowerApps Exit Function
  • PowerApps button onselect change dropdown
  • PowerApps call button onselect
  • PowerApps cancel button onselect
  • PowerApps button onselect send email
  • PowerApps button onselect hyperlink
  • PowerApps button onselect update sharepoint list
  • PowerApps button onselect patch
  • PowerApps radio button onselect
>