cancel
Showing results for 
Search instead for 
Did you mean: 

Trigger a button press/click from another button

When you have two or more buttons or even icons on a page that performs the same function, you shouldn't have to provide the same formula for both buttons. 

You should have the ability to trigger a button's click/pressed event from the other button so that you only maintain one version of the formule.

 

 

Status: New
Comments
Level 10

I believe a cleaner approach would be to be able to define functions/procedures, then you could call the same code from two or more buttons on any numbers of screens.

xx
Level: Powered On

Agree it would be a cleaner solution.  However, PowerApps seems so far away from being able to offer user defined functions.  So a more attainable solution might be to allow triggering another button.

 

Microsoft Employee

No update on this?

Level 10

This is now possible, I believe, via the Select() action.

This is not yet documented but will work.

Reference here:

https://baizini-it.com/blog/index.php/2017/09/22/powerapps-how-to-reuse-your-code-at-in-the-same-scr...

Level: Powered On

@Meneghino, I see that you can only use select it the control is on the same screen. Still helpful but would be great to trigger buttons on other screens as well.

Level: Powered On

Is there any update on when this idea possibly being implemented?

 

As it is would be very helpful functionality and aid in many aspects of form/app creation.

Level: Powered On

Hi,

I was also thinking the same way, but I figured out something like this.

If the intention is to trigger a button's function when another button is pressed, and all of them are under the same screen/page, then I suggest to use only one button consisting of all the formulas you needed. 

You can also create buttons by referring from another page by using the correct reference formula and embed them all under one button/icon (or as you needed) by using semicolon ( ; ) as a separator between formulas. 

Here is an example when I want to delete/remove some records from the list with different paramaters and at the same time I also want to patch a new data. All under one button.

 

OnSelect:

Remove(DataSource1, Filter(DataSource1, ID = "USA"));

Remove(DataSource2, Filter(DataSource2, City = "Jakarta")); 

Patch(DataSource1, Defaults(DataSource1), { ID: "Norway"})

Here the button will trigger to delete record(s) in DataSource1 with ID "USA", next it will delete record(s) in DataSource2 with City "Jakarta", and lastly it will create a new record in DataSource1 with ID "Norway".