URL Parameters with Experience Builder - Send Your Users!

7392
10
01-20-2023 08:01 PM
BrianBaldwin
Esri Regular Contributor
7 10 7,392

Experience Builder recently (in the last release) included the ability to have a few different URL parameters. Honestly – URL parameters are nothing that I have used… but I’ve found that they can be really valuable to provide a targeted way to drive viewers to a specific feature or location.

If you want to look at the current URL parameters for Experience Builder, the documentation can be pulled up here: https://doc.arcgis.com/en/experience-builder/latest/build-apps/url-parameters.htm

If you peruse this list, you’ll see it’s short on map specific URL parameters. Notably, one of the questions/needs I had from a user was related to loading up a feature at a specific zoom scale.

Currently, Experience Builder does not include a URL parameter for an ‘extent’ or ‘scale’ – so it seemed that there was no way to load a selected feature and then ‘zoom to’ with a URL. Yet, using the ‘pages’ functionality of Experience Builder – there is a workaround for creating a standard app that also has a ‘url parameter zoom to specific feature’ functionality.

In my example – I have a basic web application showing the street network of San Bernardino County. The app works, but I also want the ability to send users to specific street segments when the app opens. So… how can I do it without the ‘zoom’ url parameter?

Here is the link to my app – feel free to play around with the parameters/URL as well: https://experience.arcgis.com/experience/29285b535d614faaa60b599fc111d775/

 

1 - Main App.PNG

 

The first trick – is to use the ‘page’ functionality that is found in Experience Builder. After I have my application built out, I just duplicated it under the pages section.

 

1 - Duplicate.PNG

 

You can then rename your pages, which will be used in the URL. After you have your second page created, go to the settings for the map object and modify the initial view of the map. It doesn’t matter where you focus on, just what zoom scale you use.

 

3 - Initial View.PNG

 

After you have done this, you are basically done. You can save and publish your app.

The first URL parameter is simply the ‘page’ parameter – my original/normal app can use the default URL, or the URL to the specific page as shown here:

https://experience.arcgis.com/experience/29285b535d614faaa60b599fc111d775/page/Full

But if I want to drive users to a specific feature at the zoom scale I pre-defined, I need to use the other page that I created along with the details of the specific feature. For my app, the data, and my feature, that would look something like this:

https://experience.arcgis.com/experience/29285b535d614faaa60b599fc111d775/page/Zoom?data_id=3b8b7d77...

If I want to change the feature that gets selected in the map, I can modify it manually, or you could do this programmatically as well. If you want to play with it manually, just modify the last characters in the URL following the ‘A’ character. This is the ObjectID for the feature.

For example, take the URL: https://experience.arcgis.com/experience/29285b535d614faaa60b599fc111d775/page/Zoom?data_id=3b8b7d77...

Then replace ‘50965’ at the end of the URL string with ‘50089’, ‘32219’, or try any number!

 

URL Parameters.gif

 

That's it! Hopefully this helps a few people utilize URL parameters and a little Experience Builder trickery to create an experience that is tailored to your users needs.

10 Comments
KansasGeologicalSurvey
New Contributor II

Great how-to, I used this on a test map and it's working well. Thanks!

Is there a way to zoom to a feature using a non-object ID field? Like a way to pass in an in-house ID number instead of the AGO object ID?

BrianBaldwin
Esri Regular Contributor

Great question @KansasGeologicalSurvey - right now - it does not look like that's possible - but I'll see if @Jianxia or someone from the ExB team can help answer the question - or let us know when that type of capability might be available with URL parameters. Thanks!

Jianxia
Esri Regular Contributor

@KansasGeologicalSurvey Support for App URL parameters in Experience Builder is planned for Q4 2023. See Experience Builder 2023 roadmap.

PaulGiroux1
New Contributor III

Have you been able to get this to work with editing widget? In my app, when I pass the id in, it selects but it does NOT trigger a zoom. It does select the feature on the map and in table but does NOT trigger a change on the Edit or other widgets on the page.

It's sorta half working. Is there something I need to config in Web Experience Builder itself?

Maybe I'm missing data actions and bindings on the map widget or something?

Selection_half_a__ed.JPG

 

BrianBaldwin
Esri Regular Contributor

@PaulGiroux1  - I finally got around to testing this and I am seeing the same thing. In my test - if I 'click' on the feature to cause a 'pop-up' action to take place - it will then pass that over to the Edit widget as a selection - as expected.

BrianBaldwin_1-1676064531229.png

 

Yet - if I use that same 'selected feature' URL - it will not recognize the feature as selected - even though it's highlighted.

BrianBaldwin_0-1676064418311.png

Is this the expected behaviour @Jianxia?

AndreasHall
Esri Contributor

Great resource Brian! I found out this the hard way by trying myself, I should just have googled 😅

I had this idea that if I use URL parameters to select an object in, e.g., a list, and then define an action on this list to zoom to this object in the map, I would achieve an zoom-like URL parameter. It took some time to figure out why it zoomed sometimes and not sometimes, it was just because of my saved zoom level and had nothing to do with the actions I was configuring.

PaulGiroux1
New Contributor III

@AndreasHall , can you  expand on your comment a bit. As you can see in my comment above from 01-31-2023 that I'm still trying to figure it out. Are you suggesting I just have to tweak some Zoom level somehow and then it will successfully trigger the selection?

AndreasHall
Esri Contributor

As I understand it, the data_id parameter selects objects and make the map pan to the object, it does not trigger any actions set on the different widgets in your app. I have only tested if I can get the app to open with the map zoomed to a specific object and it is possible following Brian´s instructions above. By having two different maps in you app, saved with different default extents (and zoom levels), you can create the impression of the app zooming to a selected object, but actually it is just opening a different map that that shown as standard and panning to the object in question. I have not tested your specific workflow, my comment was regarding Brian´s original blog.

GeeteshSingh07
Occasional Contributor II

@BrianBaldwin, it's a wonderful trick...thank you so much for consolidating it and making it easier for us to understand.

My question remains the same that is it possible for non-ObjectID field? 

I am able to select/query the point using these URL parameters:  https://experience.arcgis.com/experience/fd354455c7154e8d8a554f7c6da465ba/?draft=true#data_s=where:d...:UID='3b8fdd93-3489-47cd-82c2-81b483bc53fa'

However, it doesn't zooms in to the point. 

IT_DeptDept
New Contributor II

@BrianBaldwin @GeeteshSingh07 

It looks like Brian's (OP) post references the FID field, not the ObjectID field. I wonder if the URL ID parameter references whichever field is considered the primary ID field?

About the Author
Brian works as a Lead Engineer at Esri to support customers in Education. Brian has worked as a lecturer in GIS, supported non-profits through his community planning work, and honestly just loves working with users to help solve their geospatial quandaries!