Dashboards & Visualizations

How to reset dashboard tokens using XML?

amcb90
Engager

In the past I once knew how to create a single radio button that, when selected, would reset all desired dashboard tokens, by using XML. This button would also reset itself back to being de-selected (not filled).  Does anyone know how to do this?

 

I learned how to do this previously in one Splunk's courses but I am not entirely sure which course it was. (SF 1-3 or Adv. DB Creation)

Labels (1)
Tags (3)
0 Karma

niketn
Legend

@amcb90 if you do not want to use JS you can also create and anchor html tag which would reload itself in the same browser, hence resetting the form tokens. Try by adding the following html panel in your existing dashboard and test.

    <panel id="panelRefresh">
      <html>
        <div style="float:right">
          <a href="/app/$env:app$/$env:page$" style="display:flex">
            <i class="icon-rotate"/>
            <div style="padding-left:5px;">Reset</div>
          </a>
        </div>
      </html>
    </panel>

 

If it works you can format the panel content as per your needs and then create a pre built panel as per one of my older answers: https://community.splunk.com/t5/Dashboards-Visualizations/How-to-unset-tokens-for-all-filters-and-se...

____________________________________________
| makeresults | eval message= "Happy Splunking!!!"

SR_70
Explorer

Thank you! I was able add reset feature to my dashboard. 

0 Karma

gcusello
SplunkTrust
SplunkTrust

Hi @SR_70 ,

good for you, see next time!

Please accept one answer for the other people of Community

Ciao and happy splunking

Giuseppe

P.S.: Karma Points are appreciated 😉

0 Karma

gcusello
SplunkTrust
SplunkTrust

Hi @amcb90 ,

I took this solution from answers:

  <fieldset submitButton="false" autoRun="false">
    <input type="radio" token="resetTokens" searchWhenChanged="true">
      <label></label>
      <choice value="reset">Reset Inputs</choice>
      <choice value="retain">Retain</choice>
      <default>retain</default>
      <change>
        <condition value="reset">
          <unset token="token1"></unset>
          <unset token="token2"></unset>
          <unset token="form.token1"></unset>
          <unset token="form.token2"></unset>
          <set token="resetTokens">retain</set>
          <set token="form.resetTokens">retain</set>
        </condition>
      </change>
    </input>
  </fieldset>

 

adding this code to the input section (Fieldset). 

Ciao.

Giuseppe

gcusello
SplunkTrust
SplunkTrust
0 Karma
Get Updates on the Splunk Community!

Splunk Search APIを使えば調査過程が残せます

   このゲストブログは、JCOM株式会社の情報セキュリティ本部・専任部長である渡辺慎太郎氏によって執筆されました。 Note: This article is published in both Japanese ...

Integrating Splunk Search API and Quarto to Create Reproducible Investigation ...

 Splunk is More Than Just the Web Console For Digital Forensics and Incident Response (DFIR) practitioners, ...

Congratulations to the 2025-2026 SplunkTrust!

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