For a device list block > device link column: what is the proper {{}} format to use a deviceTag in a custom url? I have tried the following, but only the deviceId is populated into the url, the deviceTag is blank:
/devices/{{deviceTags.dashboardName}}/{{deviceId}}
/devices/{{deviceTags.dashboardName.[0]}}/{{deviceId}}
@Edward_Cline,
Looks like deviceTags
come back as an array of key/value objects. Like so:
[ { "key": "your key", "value": "your value" }, .. ]
So you can reference a value like so:
{{ deviceTags.[0].value }}
Thank you - would we be able to see this in the experience page render log ( I canât seem to locate it thereâŚ)? Also, we need to reference a specific tag not knowing what its array index is, can we access with an object map similar to how you can return tags as an object map with device get workflow block?
@Edward_Cline,
I talked with the engineering team about this. We have a helper just for this case! Here is what you can do:
https://example.com/{{valueByKey deviceTags "serial"}}
You can replace serial
with the âkeyâ of the tag you would like to display.
1 Like
I have tried that helper but it doesnât resolve into anything in the url string. My url is: /devices/{{valueByKey deviceTags "dashboardName"}}/{{deviceId}}/
, each device is setup with this tag:
and the device list is setup as:
I have tried double quotes around the dashboardName key also, but no luck.
@Edward_Cline,
Hmm. This is interesting. I did confirm that this should work:
If you make the value of your URL: {{ jsonEncode deviceTags}}
. Could you send me (or screenshot) the contents of the url?
Found the problem. To have access to a device tag with {{deviceTags}} it has to be added as a column on the device list table. I had assumed {{deviceTags}} gave access to all tags of the device. Once I added it as a column it works.
Next question, we donât necessarily want to put this âdashboardNameâ tag on the device list for the user to view. Is there a way to make this column hidden?