# dashboardUrl error using two query parameters

**URL:** <https://forums.losant.com/t/dashboardurl-error-using-two-query-parameters/4798>\
**Category:** Help\
**Tags:** dashboard\
**Created:** [November 4, 2022, 11:06pm UTC](https://forums.losant.com/t/dashboardurl-error-using-two-query-parameters/4798 "2022-11-04T23:06:55Z")\
**Posts on this page:** 8\
**Page:** 1

<div class="post-metadata">

**Author:** ![Stephen\_Earthy](https://avatars.discourse-cdn.com/v4/letter/s/9e8a1a/32.png) [@Stephen\_Earthy](https://forums.losant.com/u/Stephen_Earthy)\
**Post date:** [November 4, 2022, 11:06pm UTC](https://forums.losant.com/t/dashboardurl-error-using-two-query-parameters/4798/1 "2022-11-04T23:06:55Z")

</div>

Hi - I need help again ☹  
I was using the dasboardUrl helper to construct a dashboard URL with two query parameters, and it was working fine until the last update to the platform (but not sure if that’s the exact timing it stopped working).  
The issue seems to be that the helper, or somewhere in the background, the URL is getting constructed but the ampersand in the URL is getting ‘escaped’. So, it should look like this (truncated the ids in this example):  
[https://app.losant.com/dashboards/1234...1234?ctx[deviceId-0]=789...987&ctx[gateway-0]=999...111](https://app.losant.com/dashboards/1234...1234?ctx%5BdeviceId-0%5D=789...987&ctx%5Bgateway-0%5D=999...111)

But is posted into the browser like this:  
[https://app.losant.com/dashboards/1234...1234?ctx[deviceId-0]=789...987&amp;ctx[gateway-0]=999...111](https://app.losant.com/dashboards/1234...1234?ctx%5BdeviceId-0%5D=789...987&amp;ctx%5Bgateway-0%5D=999...111)

Note the **amp;** in the second example.  
Removing the **amp;** from the URL corrects the issue and renders the dashboard correctly.

I have attempted to to add the encodeURI helper, but it continues to add **amp;** in the URL.

Any insight into this issue?  
Thanks,  
Stephen

---

<div class="post-metadata">

**Author:** ![Dylan\_Schuster](https://sea1.discourse-cdn.com/flex015/user_avatar/forums.losant.com/dylan_schuster/32/2850_2.png) [@Dylan\_Schuster](https://forums.losant.com/u/Dylan_Schuster)\
**Post date:** [November 5, 2022, 12:40pm UTC](https://forums.losant.com/t/dashboardurl-error-using-two-query-parameters/4798/2 "2022-11-05T12:40:57Z")

</div>

I haven’t been able to reproduce this issue so far; can you post an example of how you are using the `{{dashboardUrl}}` helper to get that result? As in …

```auto
{{dashboardUrl '1234...1234' ctx=(obj deviceId='789...987' gateway-0='999...111')}}

```

---

<div class="post-metadata">

**Author:** ![Stephen\_Earthy](https://avatars.discourse-cdn.com/v4/letter/s/9e8a1a/32.png) [@Stephen\_Earthy](https://forums.losant.com/u/Stephen_Earthy)\
**Post date:** [November 5, 2022, 4:38pm UTC](https://forums.losant.com/t/dashboardurl-error-using-two-query-parameters/4798/3 "2022-11-05T16:38:05Z")

</div>

I have reduced the handlebar template down to a very simple expression, removing all of the other formatting, hardcoding in the ID’s, etc. So here is the basic template, it is in a row template of a custom column on a dashboard device list block:

{{dashboardUrl ‘1234…1234’ ctx=(obj gateway-0=‘789…987’ deviceId-0=‘111…999’)}}

On the resulting dashboard here is what is rendered (this works if pasted into a browser address bar):  
[https://app.losant.com/dashboards/1234...1234?ctx[deviceId-0]=789...987&ctx[gateway-0]=111...999](https://app.losant.com/dashboards/1234...1234?ctx%5BdeviceId-0%5D=789...987&ctx%5Bgateway-0%5D=111...999)

But this is what the underlying url link is (note the **amp;** ). :  
[https://app.losant.com/dashboards/1234...1234?ctx[deviceId-0]=789...987&amp;ctx[gateway-0]=111...999](https://app.losant.com/dashboards/1234...1234?ctx%5BdeviceId-0%5D=789...987&amp;ctx%5Bgateway-0%5D=111...999)

It seems to be correctly building the url, with properly escaped characters for the “(” and other restricted http characters, but it is also swapping in the **& amp;** for the parameter separator “&”. (having trouble writing the “& amp;” with no space in this text, as the forum editor thinks I want just an & !)

---

<div class="post-metadata">

**Author:** ![Dylan\_Schuster](https://sea1.discourse-cdn.com/flex015/user_avatar/forums.losant.com/dylan_schuster/32/2850_2.png) [@Dylan\_Schuster](https://forums.losant.com/u/Dylan_Schuster)\
**Post date:** [November 5, 2022, 6:19pm UTC](https://forums.losant.com/t/dashboardurl-error-using-two-query-parameters/4798/4 "2022-11-05T18:19:09Z")

</div>

Thanks, I see what you mean now. That’s a problem we’ll have to get fixed. I think it ties back to an upgrade to our Markdown parser from a couple months ago. I will keep you posted on a fix.

---

<div class="post-metadata">

**Author:** ![Dylan\_Schuster](https://sea1.discourse-cdn.com/flex015/user_avatar/forums.losant.com/dylan_schuster/32/2850_2.png) [@Dylan\_Schuster](https://forums.losant.com/u/Dylan_Schuster)\
**Post date:** [November 7, 2022, 8:09pm UTC](https://forums.losant.com/t/dashboardurl-error-using-two-query-parameters/4798/5 "2022-11-07T20:09:21Z")

</div>

@Stephen_Earthy we just released a fix for this issue; if you check the block again from a full browser refresh, you should see the link without the double-encoded ampersands.

Thanks again for bringing this to our attention.

---

<div class="post-metadata">

**Author:** ![Stephen\_Earthy](https://avatars.discourse-cdn.com/v4/letter/s/9e8a1a/32.png) [@Stephen\_Earthy](https://forums.losant.com/u/Stephen_Earthy)\
**Post date:** [November 7, 2022, 8:22pm UTC](https://forums.losant.com/t/dashboardurl-error-using-two-query-parameters/4798/6 "2022-11-07T20:22:01Z")

</div>

Yes! Works as it should.  
Thank you for your quick attention to this!!  
Cheers, Stephen

---

<div class="post-metadata">

**Author:** ![ChrisGM](https://avatars.discourse-cdn.com/v4/letter/c/51bf81/32.png) [@ChrisGM](https://forums.losant.com/u/ChrisGM)\
**Post date:** [January 5, 2024, 11:06am UTC](https://forums.losant.com/t/dashboardurl-error-using-two-query-parameters/4798/7 "2024-01-05T11:06:35Z")

</div>

Hi @Dylan_Schuster,

We have identified a very similar issue to this thread.

When using a dashboard form, to update a device tag, we are finding that & is replaced with amp;

---

<div class="post-metadata">

**Author:** ![Dylan\_Schuster](https://sea1.discourse-cdn.com/flex015/user_avatar/forums.losant.com/dylan_schuster/32/2850_2.png) [@Dylan\_Schuster](https://forums.losant.com/u/Dylan_Schuster)\
**Post date:** [January 5, 2024, 1:22pm UTC](https://forums.losant.com/t/dashboardurl-error-using-two-query-parameters/4798/8 "2024-01-05T13:22:56Z")

</div>

That has to do with [Handlebars and HTML-escaping](https://handlebarsjs.com/guide/expressions.html#html-escaping). When you [construct the payload](https://docs.losant.com/dashboards/blocks/input-controls/#constructing-payloads) in your block, you’ll want to change `"{{myVariable}}"` (two braces, wrapped in quotes) to `{{{jsonEncode myVariable}}}` (three braces, _not_ wrapped in quotes).

The three braces tells Handlebars not to escape ampersands, quotes, and other HTML tokens. Using the [`jsonEncode` helper](https://docs.losant.com/workflows/accessing-payload-data/#jsonencode-val-spacerstr) makes sure that any user input that includes quotes (") does not terminate a string value before intended. The helper takes care of applying the opening and closing quotes around the value.
