# Call kbnUrl.change() and pass a query value as $routeParams

**URL:** <https://discuss.elastic.co/t/call-kbnurl-change-and-pass-a-query-value-as-routeparams/74530>\
**Category:** Kibana\
**Created:** [February 9, 2017, 4:17pm UTC](https://discuss.elastic.co/t/call-kbnurl-change-and-pass-a-query-value-as-routeparams/74530 "2017-02-09T16:17:35Z")\
**Posts on this page:** 7\
**Page:** 1

<div class="post-metadata">

**Author:** ![valereds](https://avatars.discourse-cdn.com/v4/letter/v/f19dbf/32.png) [@valereds](https://discuss.elastic.co/u/valereds)\
**Post date:** [February 9, 2017, 4:17pm UTC](https://discuss.elastic.co/t/call-kbnurl-change-and-pass-a-query-value-as-routeparams/74530/1 "2017-02-09T16:17:36Z")

</div>

Hi all, can I use .change() method of kbnUrl service to navigate to a saved dashboard and pass a parameter to query on state enter?  
I can navigate to the dashboard passing the url but can't figure out how paramObj works.  
Thank you.

---

<div class="post-metadata">

**Author:** ![BigFunger](https://sea2.discourse-cdn.com/elastic/user_avatar/discuss.elastic.co/bigfunger/32/7323_2.png) [@BigFunger](https://discuss.elastic.co/u/BigFunger)\
**Post date:** [February 10, 2017, 10:37pm UTC](https://discuss.elastic.co/t/call-kbnurl-change-and-pass-a-query-value-as-routeparams/74530/2 "2017-02-10T22:37:39Z")

</div>

The paramObj is a key/value mapping used for string replacements in the url parameter. If you're trying to load a dashboard and set the query to a value, try this:

```auto
 const url = '/dashboard/{{myId}}?_a=(query:(query_string:(query:{{myQuery}})))';
 const paramObj = {
   myId: '120d5d30-efdf-11e6-a9e8-417ea42ccca8',
   myQuery: 'geo-dest=TEST'
 };
 kbnUrl.change(url, paramObj);

```

kibana urls store state as rison-encoded values in the url, including the search query.

---

<div class="post-metadata">

**Author:** ![valereds](https://avatars.discourse-cdn.com/v4/letter/v/f19dbf/32.png) [@valereds](https://discuss.elastic.co/u/valereds)\
**Post date:** [February 13, 2017, 10:11am UTC](https://discuss.elastic.co/t/call-kbnurl-change-and-pass-a-query-value-as-routeparams/74530/3 "2017-02-13T10:11:42Z")

</div>

Thank you BigFunger.  
Now it works, but I'm searching something that it's not stricktly bound to the Url.  
If I save a dashboard with some visualizations, than set the url variable to match with the one of my dashboard, and then I change my dashboard adding more vis I've to change the url to match again the new dash.  
Is it right?  
Thanks

---

<div class="post-metadata">

**Author:** ![BigFunger](https://sea2.discourse-cdn.com/elastic/user_avatar/discuss.elastic.co/bigfunger/32/7323_2.png) [@BigFunger](https://discuss.elastic.co/u/BigFunger)\
**Post date:** [February 13, 2017, 3:35pm UTC](https://discuss.elastic.co/t/call-kbnurl-change-and-pass-a-query-value-as-routeparams/74530/4 "2017-02-13T15:35:10Z")

</div>

> [@valereds](#):
>
> Now it works, but I'm searching something that it's not stricktly bound to the Url.

I don't know what you mean by this.

AFAIK, the code I shared above should load the latest version that has been saved.

---

<div class="post-metadata">

**Author:** ![valereds](https://avatars.discourse-cdn.com/v4/letter/v/f19dbf/32.png) [@valereds](https://discuss.elastic.co/u/valereds)\
**Post date:** [February 13, 2017, 4:42pm UTC](https://discuss.elastic.co/t/call-kbnurl-change-and-pass-a-query-value-as-routeparams/74530/5 "2017-02-13T16:42:35Z")

</div>

Sorry my fault, You are right!  
It works like a charm. 🙂  
Thank you so much!

---

<div class="post-metadata">

**Author:** ![BigFunger](https://sea2.discourse-cdn.com/elastic/user_avatar/discuss.elastic.co/bigfunger/32/7323_2.png) [@BigFunger](https://discuss.elastic.co/u/BigFunger)\
**Post date:** [February 13, 2017, 4:43pm UTC](https://discuss.elastic.co/t/call-kbnurl-change-and-pass-a-query-value-as-routeparams/74530/6 "2017-02-13T16:43:12Z")

</div>

You're welcome! Glad I could help

---

<div class="post-metadata">

**Author:** ![system](https://us1.discourse-cdn.com/elastic/original/3X/1/a/1ac57faf039f6b580b3f104ef42a2a89e41014de.png) [@system](https://discuss.elastic.co/u/system)\
**Post date:** [March 13, 2017, 4:43pm UTC](https://discuss.elastic.co/t/call-kbnurl-change-and-pass-a-query-value-as-routeparams/74530/7 "2017-03-13T16:43:22Z")

</div>

This topic was automatically closed 28 days after the last reply. New replies are no longer allowed.
