web
You’re offline. This is a read only version of the page.
close
Skip to main content

Announcements

News and Announcements icon
Community site session details

Community site session details

Session Id :
Power Platform Community / Forums / Power Apps / Invalid variables pass...
Power Apps
Answered

Invalid variables passing to flow

(0) ShareShare
ReportReport
Posted on by Microsoft Employee

Hello - trying to initiate a .Run flow to pass a bunch of variables ( based on selections to a flow ) but it seems if the string value is left blank or no selection i am getting an error when it i try to initiate - the default selection on the canvas app is "" so I am not sure if there is a different way I should be saving these? 

 

johnc222_0-1617892778272.png

 

johnc222_1-1617892824618.png

johnc222_2-1617892848414.png

 

 

Categories:
I have the same question (0)
  • Pstork1 Profile Picture
    69,483 Most Valuable Professional on at

    The problem is that you can't pass a null parameter to the flow.  So what I normally do instead is put the parameters into a variable as a record and then use the JSON() function to pass that to flow as a single parameter.  Then in the flow you can parse the JSON to get the individual parameters.  That way you can pass a parameter even if its null.

  • Community Power Platform Member Profile Picture
    Microsoft Employee on at

    Hello -

     

    Are you able to help me understand with an example ? Rather new to PowerApps / Flow workings - currently the vars are generated OnSelect as below? Then Submitted with a different button shown above with the .Run

    Set(B211IN,B211INBOUND.Selected.Railcar);
    Set(B211OUT,B211OUTBOUND.Selected.Railcar);
    Set(B2171IN,B2171INBOUND.Selected.Railcar);
    Set(B2171OUT,B2171OUTBOUND.Selected.Railcar);
    Set(B2172IN,B2172INBOUND.Selected.Railcar);
    Set(B2172OUT,B2172OUTBOUND.Selected.Railcar);
  • RandyHayes Profile Picture
    76,299 Super User 2024 Season 1 on at

    @Anonymous 

    Please consider changing your Formula to the following:

    '374RailFlow'.Run(B211IN.Selected.Railcar, B211OUT.Selected.Railcar, B217IN.Selected.Railcar, B2171OUT.Selected.Railcar, B2172IN.Selected.Railcar, B2172OUT.Selected.Railcar)

     

    You were passing the controls to your flow, not the values.

     

    I hope this is helpful for you.

  • Verified answer
    Pstork1 Profile Picture
    69,483 Most Valuable Professional on at

    Here's some sample code. You will also have to change the flow to only ask for one parameter and then Parse the JSON. You can remove all the existing parameters by dropping the trigger and re-adding it.

     

    Set(JSONdata,{B211IN: B211INBOUND.Selected.Railcar, B211OUT: B211OUTBOUND.Selected.Railcar, other fields});
    flow.run(JSON(JSONdata, JSONFormat.Compact));

     

  • RandyHayes Profile Picture
    76,299 Super User 2024 Season 1 on at

    @Anonymous 

    Forgot to mention in my last post...I do agree with @Pstork1 in the use of passing all information as a JSON parameter rather than individual arguments as this will let your app and flow be MUCH more flexible.  However, if you are going to pass JSON instead of params, you will need to redo your flow to accommodate that.

    If you do so, then the formula mentioned will be successful.  My only 2 cents on it would be to avoid a variable for this as it is just an app clutter variable.

    '374RailFlow'.Run(
     JSON(
     {B211IN: B211INBOUND.Selected.Railcar, B211OUT: B211OUTBOUND.Selected.Railcar, other fields}, JSONFormat.Compact
     )
    );

     

  • Pstork1 Profile Picture
    69,483 Most Valuable Professional on at

    I agree with @RandyHayes about the variable.  Its just easier to explain the change since he was already using a variable.  It also makes it easier to check the values being passed when troubleshooting since you can examine the variable values in Power Apps, but not as easy when embedding the actual values.

  • Community Power Platform Member Profile Picture
    Microsoft Employee on at

    So it looks like i am currently getting an error right now 

     

    '374RailFlow'.Run

     

    Got 1 argument, expected 6

    johnc222_1-1617897051830.png

     

  • RandyHayes Profile Picture
    76,299 Super User 2024 Season 1 on at

    @Anonymous 

    As I mentioned - "However, if you are going to pass JSON instead of params, you will need to redo your flow to accommodate that."

    You need to rebuild your flow to have only one JSON parameter.  Then in your Flow, you need to parse the JSON into values.

  • Pstork1 Profile Picture
    69,483 Most Valuable Professional on at

    As I mentioned to get rid of the additional arguments you need to remove the existing trigger and re-add it.  Then you can add a new Ask In Power Apps dynamic content entry to get the JSON parameter.

Under review

Thank you for your reply! To ensure a great experience for everyone, your content is awaiting approval by our Community Managers. Please check back later.

Helpful resources

Quick Links

Introducing the 2026 Season 1 community Super Users

Congratulations to our 2026 Super Users!

Kudos to our 2025 Community Spotlight Honorees

Congratulations to our 2025 community superstars!

Congratulations to the April Top 10 Community Leaders!

These are the community rock stars!

Leaderboard > Power Apps

#1
Vish WR Profile Picture

Vish WR 846

#2
Valantis Profile Picture

Valantis 532

#3
Haque Profile Picture

Haque 410

Last 30 days Overall leaderboard