cancel
Showing results for 
Search instead for 
Did you mean: 
Rick72

How-to update a SharePoint location field from PowerApps (using Flow)

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.

2019-01-29_B.PNG

Comments

Wow! Thanks so much. We're not updating a location field from powerapps, but our users wanted to update the field using Lat/Long and not addresses. We were able to modify the payload to pass in two "Lat"/'Long" number columns without providing a street address. latlonglocation.png

 

{"__metadata": { "type": "SP.Data.TestListItem" },'testcolumn':'{"LocationSource":"Bing","LocationUri":"https://www.bingapis.com/api/v6/addresses/...%3d?setLang=en-US","UniqueId":"https://www.bingapis.com/api/v6/addresses/..%3d?setLang=en-US","DisplayName":"@{triggerBody()?['Title']}","Coordinates":{"Latitude":@{triggerBody()?['Lat']},"Longitude":@{triggerBody()?['Long']}}}'}

 

Hi @Rick72

 

What do the two long strings replace with “…” correspond to and where can we find this key/ID?

 

Thanks

 

@DonLimpio

Performing the request this way works for me:

jvdlinden_0-1706023984159.png

 

The following are my parameters set. Its getting failed. 

Krunal_Jani_0-1719244536984.png

 

The following is my body script,

 

{"__metadata": { "type": "SP.Data.Travel_x0020_requestsListItem" },'InboundLocation':'{"EntityType":"LocalBusiness","LocationSource":"Bing","LocationUri":"https://www.bingapis.com/api/v6/localbusinesses/YN1029x17840659283825473320",
"UniqueId":"https://www.bingapis.com/api/v6/localbusinesses/YN1029x17840659283825473320","DisplayName":"@{null}","Coordinates":{"Latitude"@{null}:,"Longitude":@{null}}}'}

 

Hello
I've also been trying to update my location column from the address for a while now.

2024-07-10_17-10-06.PNG

 

But I can't configure the HTTP request and I want help.

The name of my location column is "ADRESSE_A"

I get the following values as an output of the Bing map step in my flow

2024-07-10_17-14-23.PNG