Dashboards & Visualizations

Why doesn't Splunk acknowledge tokens set with JavaScript inside dashboard input tags?

pembleton
Path Finder

Hi,

I'm having a problem using tokens set with JavaScript inside my XML, specifically inside input tags.

I have a dashboard with tabs and I'm using js to set a token when I move between them.
Then I use the token in my dashboard queries so they'll run only when their respective tab is active.

All work's well for most queries, but for those inside an input tag, there's a problem: splunk doesn't acknowledge the token set within the js code. it does recognize tokens set within the xml.

js code that sets the token:

var tokens  = mvc.Components.getInstance("submmited");
tokens.set(tabToken, '');

dashboard xml:

<!-- Doesn't work! -->
<input>
<search>
<query>
index=$index$ sourcetype=$sourcetype$ $control_token$
</query>
</search>
</input>


<!-- Work! -->
<table>
<search>
<query>
index=$index$ sourcetype=$sourcetype$ $control_token$
</query>
</search>
</table>

This behavior repeats throughout the dashboard, so I don't think it is caused by a faulty query. (also it starts working immediately after expelling the control_token)

Any ideas on why might this occur?
thanks in advance.

0 Karma

alacercogitatus
SplunkTrust
SplunkTrust

Methinks you have a typo, try this:

var tokens  = mvc.Components.getInstance("submitted");
tokens.set(tabToken, '');

submitted with 2 t's and 1 m.

0 Karma

pembleton
Path Finder

the typo is only in my question, not in the source. sorry about that.
anyway i don't think the problem is in a typo.
like i said, the token does work on most queries just not inside an input tag.

0 Karma

rvisj
New Member

hi @alacercogitatus, did you find any solution or alternate to his problem, bcs I am facing the same problem.

0 Karma
Got questions? Get answers!

Join the Splunk Community Slack to learn, troubleshoot, and make connections with fellow Splunk practitioners in real time!

Meet up IRL or virtually!

Join Splunk User Groups to connect and learn in-person by region or remotely by topic or industry.

Get Updates on the Splunk Community!

Introducing ITSI 5.0: Unified Visibility and Actionable Insights

Introducing ITSI 5.0: Unified Visibility and Actionable Insights Tuesday, July 21, 2026  |  10:00AM PT / ...

Inside Splunk Agent Observability: Understanding Agent Behavior, Tokens & Costs

Inside Splunk Agent Observability:Understanding Agent Behavior, Tokens & Costs Thursday, August 06, ...

From Data to Insight: Announcing the Winners of the Splunk Dashboard Contest

Hi Splunkers, First off, thank you to everyone who participated in our very first From Data to Insight: The ...