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
Get Updates on the Splunk Community!

Introducing the 2024 SplunkTrust!

Hello, Splunk Community! We are beyond thrilled to announce our newest group of SplunkTrust members!  The ...

Introducing the 2024 Splunk MVPs!

We are excited to announce the 2024 cohort of the Splunk MVP program. Splunk MVPs are passionate members of ...

Splunk Custom Visualizations App End of Life

The Splunk Custom Visualizations apps End of Life for SimpleXML will reach end of support on Dec 21, 2024, ...