Dashboards & Visualizations

Can a foo token be passed to inline javascript

adityapavan18
Contributor

is it possible to pass the foo token as an argument to inline javascript function

Tags (3)

sideview
SplunkTrust
SplunkTrust

I feel like you're asking whether the HTML module can be given an embedded <script> tag, in which a call is made, on which call is passed a $foo$ token. Do I have the spirit of your question right?

Assuming I do, it gets really confusing fast, to try and embed script into HTML modules. The HTML module will completely re-render it's contents whenever it receives a push from upstream (see the "Introduction to the advanced XML" page in Sideview Utils for an explanation of what this means).

Instead of making function calls from an HTML module though, it is much better to make a proper interface between the module system and your custom code, in the form of a CustomBehavior module. You then embed the CustomBehavior module into some appropriate point in the hierarchy, and you define the actual behavior in application.js (See the CustomBehavior docs in Sideview Utils). If you want it to do something when it receives a push, you implement onContextChange. If you want it to provide new tokens to downstream modules, you implement getModifiedContext. Those are the two most common methods overridden but there's no limit to the other weirder things you can do.

Also make sure you've read all the Sideview Utils docs and you have the latest version. Sometimes people go to the trouble of making a customBehavior to do something that can already be done using the Sideview modules.

http://sideviewapps.com/apps/sideview-utils

0 Karma
Get Updates on the Splunk Community!

Introducing the Splunk Community Dashboard Challenge!

Welcome to Splunk Community Dashboard Challenge! This is your chance to showcase your skills in creating ...

Built-in Service Level Objectives Management to Bridge the Gap Between Service & ...

Wednesday, May 29, 2024  |  11AM PST / 2PM ESTRegister now and join us to learn more about how you can ...

Get Your Exclusive Splunk Certified Cybersecurity Defense Engineer Certification at ...

We’re excited to announce a new Splunk certification exam being released at .conf24! If you’re headed to Vegas ...