How to use dashboard context in experience view?



My dashboard context works perfectly as a Losant dashboard. However, when used as an experience view page, it does not seem to work. the URL is updated correctly in the browser bar when I click on my list of devices but the gauges always show attribute values for the default device.

In my device list on the dashboard I have the URL as:[deviceId-0]={{deviceId}} which works correctly. But when the URL is:[deviceId-0]={{deviceId}}
it does not seem to work.


1 Like
Dashboard to change Imperial/Metrics Units
Gateways, Sensors, Machines and Customers: Abstracting the Parts that Customers Don't Care to Focus On

The context variable for experience views do not work the same as in dashboards, you’re going to have to pass path parameters down to the context variables.

Let’s start from the beginning. I’ll assume you have made a route called /testdashboard. You’ll need to add a path parameter like /testdashboard/{deviceId} or if you want it to be optional /testdashboard/{?deviceId} to your endpoint. Then in your workflow, for this page, you will need to pass that parameter through to your view on the Endpont Reply Node. For this example, if you to make a custom json object to return as the page data then your json template would look like { "deviceId": {{ data.params.deviceId }} }. Then in your views dashboard, you will want to set your context variable of deviceId-0 to {{ pageData.deviceId }}.

Hope this helps,


Thanks Erin,

Understood… Just one more question, That would suggest that in my dashboard where I have my device list control that I click on a device to customise the dashboard, the device list URL would be …/testdashboard/?ctx[deviceId-0]={{deviceId}}&ctx[string-0]={{ valueByKey deviceTags ‘Site’ ‘key’ ‘value’ }}.

That would mean that my dashboard context would no longer work outside the user experience page? Ie just as a normal losant dashboard?

1 Like

That is a great point, one that I have actually never thought of before but you will have to choose which URL to use on the dashboard. My suggestion would be if you want to display the dashboard on the experience page, or if you want people to view the dashboard on Losant. If you want it on the experience page then use the experience pages URL otherwise use the one we discussed earlier.

We will try to figure out an easy way to allow you to switch back in forth between URLs like this, but currently, we do not have a helper that does what you are asking.


1 Like

I’m hitting this issue as well. Device List Block works fine as Losant Dashboard but will not operate correctly as an experience view. If I am reading this thread correctly, there is no way to code a device list block such that it will operate correctly both as a Losant Dashboard or from within an experience view?

I am stumped with this situation. How practically can a dashboard be developed using Losant dashboard and also deployed to an experience view?

1 Like

Hello! Please I need your help. I’m trying to do this, but I can’t get the dashboard take the new parameter for change the device … where does the dashboard take the new parameter into the context variable? I can only select the devices that I have created but will not let me reference {{pageData.deviceId}} I really sorry, maybe it’s easy but for me it’s not evident…

Thank you!



This text input can be a bit tricky, if you have typed the name, also check that you are clicking on the value that comes up, as you must select it as well. Here is how it will appear when correctly selected:

If you are still unable to reference the deviceId, let me know and we will look again!


1 Like

Thks! works! your help is wonderful!

1 Like

So it seems this thread is very similar to the issue I am currently trying to work through:
On our custom URL the user can create a machine and select it to see all the sensors that are on that machine:

This is the /machines page/endpoint… a dashboard which lists all the devices (that have a deviceTag companyName=logged in user’s company + have a deviceTag deviceType=machines).

This link is putting the correct deviceId into the URL for the next page… but when I get to the /machine/{deviceId?} page it seems that the context information isn’t updated from the default selection to the information in the URL. Notice the URL has the “machineId” to get set to the deviceId of the device that was clicked in the device list block from the previous page (/machines)… but the context that is set in the new dashboard (/machines/{deviceId?}) does not reflect the context that I have passed in :

FYI is how I have configured the endpoint:

The device information that is in the URL points to a device with a name of “Machine_B” once updated from the default of “testunit”.
See default set here:

No matter where the context variable is called within the dashboard it does not update to the selected device (the one selected from the previous device list block).

Notice how the context variable for machineId-0 is set in the URL but the place where this variable is called within the dashboard (in the block header box) does not update from the default “testunit” to the newly passed context of “Machine_B”.

Although I’ve been given access to the multi-tenant example this part isn’t very useful because I cannot see how the device blocks or context variables are set up.


Hi Leo!

The URLs are set a bit differently in the Multi-Tenant example, I will give you access to see the dashboard block configuration. The endpoint for the deviceID path is named as /device/{deviceId}:

The URL for the deviceId is with {{deviceId}}:

I believe these changes may solve the context not being updated, but please let me know if not and we will look again!


Dashboard configuration access for the muli-tenant example would be very helpful.


Hi Leo,

I cloned the “Your Devices” dashboard and gave you full permissions. Feel free to play around and change things, it is a clone!


1 Like

Can you clone the “device details” dashboard as well so I can make sure I’m passing the data correctly on that side as well?

1 Like

Done! Let me know if you have any questions :smile:



I’m still struggling for some reason… when I pass the data from one dashboard to the next using the deviceId it still shows the default regardless of which deviceId that shows in the URL.

I’ve tried to copy the example exactly but there must be something that I’m missing.

Even when I change the context name (which I didn’t think could be an issue) the dashboard still shows the old context variable.

Renamed to just deviceId:

Still shows the old context variable under the dashboard:


Hi Leo!

I took a look at your experience to see if I could locate the culprit. :grinning:

The {{}} you are seeing under Selected Machine is the user-defined description that was set for the dashboard, so fear not! Your context names are successfully being updated. You can locate and change the description by clicking on Edit Settings on the dashboard page.

I was also able to locate a slight difference between the Multi-Tenant Example and your application that could be the problem. It looks as though the Dashboard Context on your Machine Page has not been set for {{ctx.deviceId}}. This seems to be what is setting the Device ID in the Multi-Tenant Example, allowing the user to see data based on the device they selected!

I will continue to look into this and see if I can find anything else that could be preventing you from setting the context.



So maybe I am the only one that is confused by this… but why are there two places for setting the dashboard context? You can set it both through the dashboard itself (in the top right corner) and through the Experience Page (at the bottom of the form)… do they do different things within Losant or are there just 2 places to perform the same task?


Great question! Dashboard context can be set on the dashboard page itself, but when used in an experience, the data is essentially “passed” to the page. Experience pages that display dashboards do not show configuration options like the regular dashboard, so your context cannot be set from the experience page itself:

We created Dashboard Context in the experience to allow for the Multi-Tenant setup, as it was not possible previously. If you wanted a user to have a custom dashboard based on a user group, you would have to make dashboards for each group, and create a page and workflow for each dashboard. Context is one of the more difficult parts of Losant to understand, so you are definitely not the only one!

Here are a couple more resources on context: