Skip to main content
Community site session details

Community site session details

Session Id : MHNlFGQ03zCHcpSES8BM+z
Power Apps - Building Power Apps
Answered

Pass Location Info to Flow

Like (0) ShareShare
ReportReport
Posted on 26 Apr 2019 15:50:16 by 4,531 Most Valuable Professional

Team,

I've done a bit of searching and can't find anything overtly relevant, but I'm new...so apologies if this is covered somewhere.

 

I'm looking to create a PowerApp with just a single button.   When the user presses it, the location information is captured from the mobile device and passed to a Flow.

 

I've tried simple stuff (I'm not into code at all) like using UpdateContext on the OnSelect to set lat: Location.Latitude and so on, but that doesn't show as a dynamic value in Flow for me to use in the action.

 

Is this possible?  Seems like it would be.

Thanks for the help

  • Community Power Platform Member Profile Picture
    on 29 Apr 2019 at 12:34:05
    Re: Pass Location Info to Flow
    Looks like you have the solution but here is a post on working with flow and geo coding that might offer some additional insight
    https://saralagerquist.com/2019/04/25/geocode-a-custom-entity-with-microsoft-flow/
  • Community Power Platform Member Profile Picture
    on 29 Apr 2019 at 07:59:02
    Re: Pass Location Info to Flow
    If the json that comes back from your HTTP Get request is neat and tidy, you could create your own custom connector. It needs plan 1 but so will your flow.

    If you know what a HTTP Get thingy is then you are more than able to create one! Super simple.
  • Mr-Dang-MSFT Profile Picture
    on 28 Apr 2019 at 23:25:01
    Re: Pass Location Info to Flow

    Any time that you are creating a flow that is triggered by PowerApps, you need to tell the Flow what you are going to feed it from PowerApps.image.png

     

    In Flow, you'll see 'Ask in PowerApps' appear as an option for Dynamic Content. If it doesn't, click 'See More.'

    image.png

     

    Above, I have 8 things that I want PowerApps to tell the flow so it can do a Bing image search; these are its parameters. 

     

    Every API is different and requires different type of data. So earlier I gave an example of sending latitude and longitude as two separate parameters--that would only work if in the flow, you had clicked 'Ask in PowerApps' in two places. You'll need to adjust it to fit whatever setup you have in your flow.

     

    You'll need to go into the API reference for the call you want to make to see exactly what information you want to feed it and in what way. It's really just about sending the right data types at this point.

     

    @SanAndresMan1 @seadude @ThatAPIGuy 

    I know @seadude has specifically used lat longs in his flows and custom connectors.

    @ThatAPIGuy has a youtube example using HTTP + PowerApps + Flow.

     

    And here's an example using lat longs in a hiking app with app and flow included: 

    https://aka.ms/hiking/package

    You can import it at web.powerapps.com -> Apps -> Import -> Upload the zip file.

  • Mariano Gomez Profile Picture
    48 on 28 Apr 2019 at 22:21:09
    Re: Pass Location Info to Flow

    Ed,

    Check your Twitter inbox

  • Ed Gonzales Profile Picture
    4,531 Most Valuable Professional on 28 Apr 2019 at 21:58:20
    Re: Pass Location Info to Flow

    I'm getting the error from within PowerApps, and I don't think it's running the Flow with the error.

     

    I pretty much copied and pasted what you have and am still getting the error.  If I try to run the app with the error, the Flow never triggers.

  • Mariano Gomez Profile Picture
    48 on 28 Apr 2019 at 21:48:45
    Re: Pass Location Info to Flow
    Ed,

    Yes, I did get the invalid number of arguments error on a set variable operation, which I never introduced to begin with. I believe this is a flow bug. All I did was I passed in a value of 1.

    LocationFlow.Run(1, txtLatitude, txtLongitude)
  • Ed Gonzales Profile Picture
    4,531 Most Valuable Professional on 28 Apr 2019 at 21:33:55
    Re: Pass Location Info to Flow

    Thank you both for the help.  I'll hit them both in order and let you know what I found:

     

    For Brian's ( @Mr-Dang-MSFT  ) - I get a couple of errors in PowerApps.  The first is "Invalid number of arguments: received 2, expected 1".  So I change the OnSelect formula to FlowName.Run(Text(Location.Latitude)) (thinking that I'd get rid of one of the arguments) and now I get: Invalid argument type (Text). Expecting a Record value instead. AND The function 'Run' has some invalid arguments.  I did change "FlowName" to match my Flow.

     

    For @SanAndresMan1  - When you say "I then pointed the LocationFlow.Run() parameters to txtLatitude and txtLongitude.", do you mean the formula actually looks like "Flowname.Run(txtLatitude, txtLongitude)"?  Because that generates the 'number of arguments' error listed above.

     

    Thanks again to both of you for the help.

    -Ed-

  • Verified answer
    Mariano Gomez Profile Picture
    48 on 28 Apr 2019 at 19:47:28
    Re: Pass Location Info to Flow

    This should be fairly straight forward:

     

    1. I have added 2 labels, one called txtLatitude and made that Location.Latitude; and one called txtLongitude and made that Location.Longitude - NOTE: just did this so you can see the location of the device, but this is not necessary as you can pass in Location.Latitude and Location.Longitude directly to the flow.

     

    2. I then created a flow called Location Flow, and use PowerApps as the trigger. I then added 2 steps, each with an Initialize Variable, and in both cases I asked it to Ask in PowerApps, both variables of type Float.

     

    3. I added an additional step to the flow to send me an email with the coordinates, just to test it was working

     

    4. I went back to PowerApps and added a Submit button, then pointed to Action | Flows for this button and selected the Flow I just created. I then pointed the LocationFlow.Run() parameters to txtLatitude and txtLongitude. 

     

    I was able to successfully run the app and the flow. Please let me know if you have any questions

  • Mr-Dang-MSFT Profile Picture
    on 28 Apr 2019 at 04:49:16
    Re: Pass Location Info to Flow

    Clicking the button to get the location gets you a static value of where you are in that moment. The variable does not change until you click the button again.

     

    There's a few ways to do what you want to achieve.

    1. Multiple actions can be done with the click of a button by chaining them with a semi-colon. In your case, you'll want to figure out the current lcoation before running your flow.

      Set(varLocation,Location);
      
      FlowName.Run(Text(varLocation.Latitude),Text(varLocation.Longitude))
      The semicolon makes the actions go in order. The second action will not proceed until the first one completes.
    2. You can skip the variable altogether and feed the location directly in the Flow statement:
      FlowName.Run(Text(Location.Latitude),Text(Location.Longitude))

    Note that in both cases, I wrapped Text around the location. I assume whatever you're using is going to consume them as text. Remove Text() if you want it as a number.

     

    Also note that I'm assuming your flow has 2 parameters, the first asking for lat, the second for long. Move things around as needed.

     

     

  • Ed Gonzales Profile Picture
    4,531 Most Valuable Professional on 28 Apr 2019 at 04:32:50
    Re: Pass Location Info to Flow

    @Mr-Dang-MSFT - 

    Thanks for the response.  I did consider just a Flow button (would be a ton easier for me) but there are two main reasons for using PowerApps - 

    First - I am using the location to feed an HTTP GET thing, which will return some JSON results that I'd like to present in a gallery.  To do this in Flow, I think I am limited to something like an HTML email or adaptive cards (blog on that coming soon), which was not the experience I was going for in this project.

     

    Second - I want/need to teach myself practical Power Apps.  I've done the App in a day and done some connecting to data, but I get flummoxed quickly because I don't code.  I think there is an audience of similar folks looking to expand their knowledge and usefulness, but maybe not wanting the deep rabbit hole that is programming/code.  My intent is to go from zero to one and help others do the same.

     

    Back to the original query, though, once I set the variable in PowerApps, does that create a dynamic value for me to use in subsequent Flow actions?  I can't seem to get that part to work.

     

    Thanks again for the help.

     

    -Ed-

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

Announcing our 2025 Season 2 Super Users!

A new season of Super Users has arrived, and we are so grateful for…

Paul Stork – Community Spotlight

We are honored to recognize Paul Stork as our July 2025 Community…

Congratulations to the June Top 10 Community Leaders!

These are the community rock stars!

Leaderboard > Power Apps

#1
WarrenBelz Profile Picture

WarrenBelz 637 Most Valuable Professional

#2
stampcoin Profile Picture

stampcoin 570 Super User 2025 Season 2

#3
Power Apps 1919 Profile Picture

Power Apps 1919 473