# How pass a context variable as deviceTag

**URL:** <https://forums.losant.com/t/how-pass-a-context-variable-as-devicetag/2806>\
**Category:** Help\
**Tags:** experience, dashboard, context-variables\
**Created:** [April 8, 2020, 5:33pm UTC](https://forums.losant.com/t/how-pass-a-context-variable-as-devicetag/2806 "2020-04-08T17:33:41Z")\
**Posts on this page:** 5\
**Page:** 1

<div class="post-metadata">

**Author:** ![Vander\_Maziero](https://sea1.discourse-cdn.com/flex015/user_avatar/forums.losant.com/vander_maziero/32/3428_2.png) [@Vander\_Maziero](https://forums.losant.com/u/Vander_Maziero)\
**Post date:** [April 8, 2020, 5:33pm UTC](https://forums.losant.com/t/how-pass-a-context-variable-as-devicetag/2806/1 "2020-04-08T17:33:41Z")

</div>

Hi,

I’m trying to pass a context variable (parentId = {{request.query.deviceId}}), through experience, as [Device Tag](https://docs.losant.com/dashboards/context-variables/#device-tags) to the dashboard. I found this [case](https://docs.losant.com/dashboards/context-variables/#experience-page-parameters) in the documentation, where the fields are generated for a specific dashboard (and generates key-value fields for the context of type deviceTag), but in my case the ID of dashboard is dynamic, and I should pass the key and value of the deviceTag in the value field, as shown in the figure, is this possible? And if possible what would be the format?

 ![image](https://us1.discourse-cdn.com/flex015/uploads/getstructure/original/2X/5/57acec93d6117d6dbafeff7e3e40b85f8f009abb.png)

Or how could I pass that same context, but using {{element ‘dashboard’ dashboardId = pageData.dashboards.dashId ctx = (obj deviceId = request.params.deviceId parentId = ???)}}? I tried to use something like [this](https://docs.losant.com/dashboards/context-variables/#direct-url-manipulation), but without success.

This [topic](https://forums.losant.com/t/how-to-use-dashboard-context-in-experience-view/828/8) is similar to I’m trying to solve, but I also haven’t found an answer for the deviceTag use case as a context. Since for the other types of context variable, I can use it normally.

Any suggestion?

---

<div class="post-metadata">

**Author:** ![anaptfox](https://sea1.discourse-cdn.com/flex015/user_avatar/forums.losant.com/anaptfox/32/873_2.png) [@anaptfox](https://forums.losant.com/u/anaptfox)\
**Post date:** [April 8, 2020, 7:05pm UTC](https://forums.losant.com/t/how-pass-a-context-variable-as-devicetag/2806/3 "2020-04-08T19:05:10Z")

</div>

@Vander_Maziero,

Yeah, this looks like a hard one to do from within the UI. I’m putting in a ticket for that. However, here is how you would do it using the `element` helper:

```auto
{{ element "dashboard" dashboardId=(template "58ebd885e326860001a6699f") ctx=(obj devId=(template "{{request.query.deviceId}}") deviceTag-0=(obj key=(template "DeviceRecipe") value=(template "{{request.query.value}}"))) theme=(template "light") time=(template "") }}

```

---

<div class="post-metadata">

**Author:** ![Vander\_Maziero](https://sea1.discourse-cdn.com/flex015/user_avatar/forums.losant.com/vander_maziero/32/3428_2.png) [@Vander\_Maziero](https://forums.losant.com/u/Vander_Maziero)\
**Post date:** [April 8, 2020, 8:36pm UTC](https://forums.losant.com/t/how-pass-a-context-variable-as-devicetag/2806/5 "2020-04-08T20:36:45Z")

</div>

Thanks @anaptfox this example of use of `element` solve my problem!

---

<div class="post-metadata">

**Author:** ![Vander\_Maziero](https://sea1.discourse-cdn.com/flex015/user_avatar/forums.losant.com/vander_maziero/32/3428_2.png) [@Vander\_Maziero](https://forums.losant.com/u/Vander_Maziero)\
**Post date:** [April 8, 2020, 9:23pm UTC](https://forums.losant.com/t/how-pass-a-context-variable-as-devicetag/2806/7 "2020-04-08T21:23:37Z")

</div>

@anaptfox Just another possible bug, if I use only the helper `element`, with no other characters in the block content, when saved, the page automatically changes the `page type` from `Custom` to `Dashboard`, but if I insert another character, like a space, it doesn’t happen , and the page type remains as custom. Like as in the sequence of images.

1. Page as Custom, just with helper `element`  

2. Saved - change to type Dashboard  

3. Page as Custom, caractere space more helper `element` - save and work

---

<div class="post-metadata">

**Author:** ![anaptfox](https://sea1.discourse-cdn.com/flex015/user_avatar/forums.losant.com/anaptfox/32/873_2.png) [@anaptfox](https://forums.losant.com/u/anaptfox)\
**Post date:** [April 9, 2020, 4:25pm UTC](https://forums.losant.com/t/how-pass-a-context-variable-as-devicetag/2806/8 "2020-04-09T16:25:00Z")

</div>

So, this exposes a pretty cool thing about Dashboard Pages. Today, behind the scenes, they aren’t a special kind of page. A Dashboard Page is simply a page with _only_ (even down to the spaces) the `element` helper pointing to a Dashboard. So, that’s why you’re seeing this behavior here.

However, I’m making a ticket about this to improve this experience a bit. 🙂
