Is it possible to declare variables with any function or code in Flow manually and reference to them later in PowerApps?
The only known possibility for me is to use the Ask in PowerApps function. This is very confusing if you are using more as 100 in one single flow. Additionaly you need to keep the order from the first to the last variable.
If you are talking about declaring variables when calling a flow from Power apps then take a look at the Power Apps V2 trigger. With that trigger you can create all the parameters in the trigger and won't need to use Ask in Power Apps. However you will still need to add them in the order that they are declared. When sending a large number of parameters to a flow I normally add them all to a record or a collection in Power Apps and then send that as a single string to the flow using the JSON() function. That string can then be parsed in the flow using the Parse Json action to get the individual parameters.
Unfortunately the v2 trigger is limited to 19 variables only.
There is some workaround with JSON, but I think with the standard trigger and Ask in PowerApps it's still faster.
The problem is that when you get that many parameters, with either trigger, its almost unusable in the Power App. As you mentioned the parameters need to be entered in order and the intellisense prompting in the Power App gets cut off after the first couple parameters. I've seen lots of issue with errors because the wrong values are in the wrong place in the parameter list. Send the values as a JSON string gives all the values a key name so the order no longer matters. You can change the layout of the record/collection at any time and as long as you update the schema in the flow it will continue to work. If you have that many parameters I really suggest you look into sending them as JSON.
Also, the V2 trigger is no slower than the V1 trigger if the parameters are correct. Its just a difference in the way the parameters are defined. The V2 version is much easier to maintain.
Join us for the next call on August 17, 2022 at 8am PDT.
The first Microsoft-sponsored Power Platform Conference is coming in September. 100+ speakers, 150+ sessions, and what's new and next for Power Platform.
Join us for two optional days of workshops and a 3-day conference, you can choose from over 130 sessions in multiple tracks and 25 workshops.