Dashboards & Visualizations

Splunk button javascript unset token- Is there a method to unset the splunk's token after the page refresh?



I have a button that take values from splunk's tokens, launch a search that update a KV Store and refresh the page.

Is there a method to unset the splunk's token after the page refresh?

I tried with the "tokens.unset("name of the token", null);" command in javascript but this method didn't work for me.

I took all the tokens with this command "var tokens = mvc.Components.get("default");"



Labels (2)
0 Karma


How are you currently updating your KV Store or refreshing the page through JS? One of those can have the code to unset the token.

Also unset token code is something like the following:


Besides depending on your use case you may want to unset both default and submitted token model. Further, you would need to ensure that unsetting the token does not trigger unwanted execution of token change event which you may already have.


| makeresults | eval message= "Happy Splunking!!!"
0 Karma


In JS with the button I submit a search that update the KVStore and refresh the page.

The token came from an input fields where I set the new values of the KVStore.

After the refresh I try to unset the token.

The problem is that, after the refresh, the input fields remain full of the value of the token, instead of blank inputs.

I tried to use your command before the window.location.reload(); but it didn't work and the input form remained with the old values.



0 Karma

Splunk Employee
Splunk Employee

Try the code below to change the selection of your input.

        function unsetToken(name) {
0 Karma
Get Updates on the Splunk Community!

Don't wait! Accept the Mission Possible: Splunk Adoption Challenge Now and Win ...

Attention everyone! We have exciting news to share! We are recruiting new members for the Mission Possible: ...

Unify Your SecOps with Splunk Mission Control

In today’s post, I'm excited to share some recent Splunk Mission Control innovations. With Splunk Mission ...

Data Preparation Made Easy: SPL2 for Edge Processor

By now, you may have heard the exciting news that Edge Processor, the easy-to-use Splunk data preparation tool ...