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!

Updated Team Landing Page in Splunk Observability

We’re making some changes to the team landing page in Splunk Observability, based on your feedback. The ...

New! Splunk Observability Search Enhancements for Splunk APM Services/Traces and ...

Regardless of where you are in Splunk Observability, you can search for relevant APM targets including service ...

Webinar Recap | Revolutionizing IT Operations: The Transformative Power of AI and ML ...

The Transformative Power of AI and ML in Enhancing Observability   In the realm of IT operations, the ...