Dashboard context is missing as Viewer

Hi there,
not sure if this is a bug or a feature but I noticed that when I invited users as Viewers into a dashboard they are unable to see the list of devices from the context menu.

Is there a workaround for it?

That is by design; if a user is consuming your dashboard with view-level permissions, they do not necessarily have view-level permissions on the application associated with that context variable. To avoid exposing information about your application (device names and IDs), we do not expose our device selector in that case.

As for a workaround - you could include a Device List dashboard block and change the link for each device row, so that it uses the {{dashboardUrl}} helper to visit that same dashboard, but with the context updated to reflect the chosen device. Something like `{{dashboardUrl ctx=(obj CTX_VARIABLE_NAME=deviceId)}}

so this is ugly but working

but how do I use that magic syntax to maybe just show the device id without the full url?

This is how I have done it

image

but would be nice to put an html tag to hide the full url.

You can use a combination of the variables exposed to the render context and Markdown to get what you’re after:

[{{device.id}}]({{dashboardUrl ctx=(obj CTX_VARIABLE_NAME=deviceId)}})

Hmmm I am confused, in that way the dashboardUrl is pointing to itself which is not good.

How do change the dashboardUrl to point to the target URL?
I tried to replace it like this

[{{device.id}}]({{“https://app.losant.com/dashboards/62ff4ab90aaaa593ea7ddd00” ctx=(obj deviceId=deviceId)}})

But then the link disappear.

Check out the same link to the {{dashboardUrl}} helper docs from before - you’ll see that it takes an id as its context argument. So if you’re trying to link to a different dashboard than the one where this block lives (sorry, that was not clear to me from the info I had), just change that helper to:

[{{device.id}}]({{dashboardUrl "ID_OF_OTHER_DASHBOARD" ctx=(obj CTX_VARIABLE_NAME=deviceId)}})

Okay corrected like so

[{{device.id}}]({{dashboardUrl “62ff4ab90aaaa593ea7ddd00” ctx=(obj deviceId=deviceId)}})

The links are not generated properly both looks like this:

https://app.losant.com/dashboards/62ff4ab90aaaa593ea7ddd00

Also tried:

[{{device.id}}]({{dashboardUrl “62ff4ab90aaaa593ea7ddd00” ctx=(obj deviceId=device.id)}})

Because I need the device.id right as the value of the parameter?

It doesn’t seem to generate properly the url parameters.

You’re right about having to use device.id as the value, not deviceId. That’s my fault, sorry.

However, I tested your string in the Row Template for a Custom column in a Device List Block and it appears to be rendering the URL with context variables correctly. See the attached screenshot.

https://app.losant.com/dashboards/62ff4ab90aaaa593ea7ddd00?ctx%5BdeviceId%5D=57a341c2330cf101001e5190

I am getting some very weird behaviour:

The link:

It seems to be ignoring the argument and still pointing to the current dashboard.

I think you have special characters around your dashboard ID and because of that it is throwing the value away and using the ID of the current dashboard. That happened to me when copying your input from these forums.

Try deleting the quotes around the ID and re-typing them.

It was somehow the double quotes were unicodes! This is all working now.