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!

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 ...

What's new in Splunk Cloud Platform 9.1.2312?

Hi Splunky people! We are excited to share the newest updates in Splunk Cloud Platform 9.1.2312! Analysts can ...

What’s New in Splunk Security Essentials 3.8.0?

Splunk Security Essentials (SSE) is an app that can amplify the power of your existing Splunk Cloud Platform, ...