Not to long ago, Microsoft introduced the column type “Location” in SharePoint Online. This is a great addition for business solutions. From a PowerApps perspective, the usefulness is limited to showing data (Country/Region, State, City, Postal Code and Street).
So is it not possible at all to update a location field from PowerApps?
It is: Flow to the rescue!
There is a restriction though: The locations should be known beforehand, but this restriction still allows for a lot of usefulness. You can select a value for an entity (For example: A building) and when saving your item, this value is transformed to a location value in the location field. There must be a entity-location value mapping available for this to work though. This could be hardcoded in Flow but a much better approach is to use a SharePoint list for this.
So how can Flow help? The “Update item” action will not allow you to update a location field. No worries, Flow has a swiss army knife action called “Send an HTTP request to SharePoint” with which you can use REST to update a list item.
When a location is saved, the settings are saved internally in a JSON format like:
{"LocationSource":"Bing","LocationUri":"https://www.bingapis.com/api/v6/addresses/...%3d?setLang=nl-NL","UniqueId":"https://www.bingapis.com/api/v6/addresses/..%3d?setLang=nl-NL","DisplayName":"Lange Dreef 17, 4131 NJ Vianen","Address":{"Street":"Lange Dreef 17","City":"Vianen","State":"Utrecht","CountryOrRegion":"Nederland","PostalCode":"4131 NJ"},"Coordinates":{"Latitude":51.98469161987305,"Longitude":5.105350017547607}}
The example above is the HQ location for my new employer “Sogeti – The Netherlands” and I replaced two long strings with “…”. The JSON values can be retrieved using PowerShell or via the url “…/_api/web/lists/getbytitle(‘Locations’)/items”. My SharePoint list is called “Locations”. The field name is “Location”.
Flow collects the right value for the location field based on the value of the entity and then updates the item’s location field using the action “Send an HTTP request to SharePoint”.
Using REST is not really “Citizen developer” stuff, but if you have a bit more experience/affinity with technology, you should be able to find enough info to get it to work. below I presented a screenshot which works for me.