Remove Unused PowerApps Variables from Power Automate

Introduction

A common requirement while working with Power Apps is to call Power Automate from the app and pass parameters to the flow for executing a logic.

Within Power Automate, we can Initialize the variable using the “Ask in Power Apps” property which will create the variable by the name <ActionName>_Value. We can use this within the flow expecting that value will be passed as an input parameter from Power Apps

Graphical user interface, application

Description automatically generated

To pass the value to the above-initialized variable, we use the <FlowName>.run(<Parameters>) expression in the OnSelect of the button within the Power App.

Graphical user interface, text

Description automatically generated

Problem Statement

When we are using the Initialize variable action and clicking the Property Ask in Power Apps, it created a variable for use within the flow. However if we have mistakenly clicked the “Ask In Power Apps” property for a second time, it will create a second variable and it will be a mandatory variable for which value has to be passed from Power App.

Note: There is no way to easily remove the duplicate variable created in the Flow. As of the writing of this article, this is still a user-requested feature in the User Voice.

Graphical user interface, application

Description automatically generated

If we head over to the Power App, we can see the Flow calling expression will be expecting a second value now, due to the newly added variable.

Graphical user interface, text, application

Description automatically generated

Solution

Currently, there is no way to manage the created variables in Power Automate or make the passing of parameters optional as Flow expects both as mandatory values. The workaround as of now is to delete the Power Apps trigger in the Flow and re-add the trigger which will remove all the created variables and we can re-add the needed variable back using the “Ask in PowerApps” property.

Graphical user interface, application

Description automatically generated

Now we can re-add the PowerApps trigger and head over to the Initialize Variable action and add the Variable once again

Graphical user interface, text, application

Description automatically generated

Thus, it has readded just one variable which we will be passing in from Power App

Graphical user interface, application

Description automatically generated

Summary

Thus, we saw how to manage the duplicate or accidental Power App variables created in Power Automate as we don’t have a straightforward way to manage the variables inside Power App or Power Automate.

Related Articles

Author

Author

Priyaranjan KS is a Modern Workplace Architect primarily focused on developing and architecting solutions around Office 365,Power Platform and Azure.He is also a Microsoft Most Valuable Professional(MVP) and a Microsoft Certified Trainer(MCT)

Latest Articles