Dashboards & Visualizations

Token transfer between different dashboards using SplunkJS

MikeJu25
Path Finder

My source dashboard has a clickable table and once a user clicks a row the user will be taken to a destination dashboard and the token will be set to database_id which is then passed in to run a search on the destination dashboard. Now both two dashboards are using a single JS file. But I realized that the token will not be successfully passed in to the search as the token value is not set when the destination dashboard reads the JS file. Could someone please provide help on how should I transfer the token value between two dashboards using SplunkJS? Thank you in advance!

Here's the code for event handler on the source dashboard:

 

allassetstable.on("click", function(e) {
        // Bypass the default behavior
        e.preventDefault();
        // set token name and value
        tokenSet.set("databaseID_tok", e.data.click.value);
        // link back to asset-specific anomalies page
        utils.redirect("Ano","_blank"); 
    });

 

 

Below is the code for search on the destination dashboard:

 

    var search2 = new SearchManager({
        id: "ano",
        preview: true,
        cache: true,
        latest_time: "now",
        search: "index=anomalies database_id=$databaseID_tok$"
    }, {tokens: true});

 

 

 

Labels (3)
0 Karma
1 Solution

kamlesh_vaghela
SplunkTrust
SplunkTrust

@MikeJu25 

Can you please try this?

allassetstable.on("click", function(e) {
    // Bypass the default behavior
    e.preventDefault();
    // set token name and value
    // tokenSet.set("databaseID_tok", e.data.click.value);
    // link back to asset-specific anomalies page
    utils.redirect("Ano?databaseID_tok="+e.data.click.value,"_blank"); 
});

 

Thanks
KV
▄︻̷̿┻̿═━一

If any of my reply helps you to solve the problem Or gain knowledge, an upvote would be appreciated.

View solution in original post

kamlesh_vaghela
SplunkTrust
SplunkTrust

@MikeJu25 

Can you please try this?

allassetstable.on("click", function(e) {
    // Bypass the default behavior
    e.preventDefault();
    // set token name and value
    // tokenSet.set("databaseID_tok", e.data.click.value);
    // link back to asset-specific anomalies page
    utils.redirect("Ano?databaseID_tok="+e.data.click.value,"_blank"); 
});

 

Thanks
KV
▄︻̷̿┻̿═━一

If any of my reply helps you to solve the problem Or gain knowledge, an upvote would be appreciated.

Get Updates on the Splunk Community!

Index This | I am a number, but when you add ‘G’ to me, I go away. What number am I?

March 2024 Edition Hayyy Splunk Education Enthusiasts and the Eternally Curious!  We’re back with another ...

What’s New in Splunk App for PCI Compliance 5.3.1?

The Splunk App for PCI Compliance allows customers to extend the power of their existing Splunk solution with ...

Extending Observability Content to Splunk Cloud

Register to join us !   In this Extending Observability Content to Splunk Cloud Tech Talk, you'll see how to ...