Context through dashboard element not working

Trying to pass deviceId through /{deviceId} into an element dashboard. But I cannot get it to work. I checked out various related topics but, they all seem to use dashboard pages rather than elements. Any suggestions would be appreciated.

Workflow

Experience Page

Dashboard Context Settings

Hi @Michael_Carlstrom, and welcome to the Losant Forums.

Your screenshot doesn’t show your entire {{element}} helper but from what I can see, you appear to be on the right track:

{{element "dashboard" dashboardId="66e084af99600e7c7cd29a16" ctx=(obj deviceId=request.params.deviceId)}}

It’s possible your commented-out helpers could be causing a problem, as the helper renders to something like …

<span>
<script type="text/javascript">
window._losantInlineDashInfo = {"dashboardId":"66e084af99600e7c7cd29a16","duration":3600000,"resolution":5000,"hideHeader":true,"theme":"dark","authToken":"TOKEN_HERE"};
</script>
<script type="text/javascript" src="https://app.losant.space/inline-dash.js"></script>
</span>

… and I don’t think HTML comments will stop those scripts from executing. Instead, you can prevent them from rendering anything to the DOM using Handlebars comments.

Please give that a try and, if you’re still having issues, please let us know more specifically what problems you are running into (incorrect context, validation errors, etc.). Screenshots, browser console output, render log entries, whatever you can provide will help.

Thanks so much. I tried removing the comments but that didn’t help. Any other Ideas?

The page currently looks like this.
image

For context the dashboard in the dashboard tab looks like this.

I removed the comments to no avail.

It looks like you’re passing the name of the device (“45176”) instead of the ID of the device as assigned by Losant when you create it. You can find the device ID at the top of its detail page and also in the URL bar.

If your requirements dictate that the name property - or the value of a tag, or anything other than the Losant ID - is what appears in the URL, you can do that but it will require bringing a workflow into the mix to look up the device by what’s passed in the URL and resolve it to the Losant device ID.