Dashboards & Visualizations

including javascript in data > ui> alert > test.html , but javascript is not working


under this folder structure


I am trying to include a JavaScript code or JavaScript file under "test.html" but it is not happening

<form class="form-horizontal form-complex" script="test.js">
    <input type="text" name="action.test.param.confgid" id="create_tests_confgid"   />

following code is written in test.js

  alert("testing the alert ");

Note : I am able to see the form on web interface of splunk but the java script code is not executing .

Can anyone help me to include the JavaScript code to specified code structure?

Amit Vikram


It is not possible to use javascript in custom alert html code. The docs themselves don't say this explicitly, but you can refer to the comments below the appropriate documentation where SK8 asked the exact question.
Feel free to leave feedback on that page requesting clarification (using the "Was this topic useful?"-section at the bottom), the docs team is super awesome and will appreciate your input.


Hi Jeffland,

Thank you for taking time to reply to my query.

I had read the article earlier which you suggested but it was ambiguous , under topic :Security Consideration they says:

"Except for a dynamic dropdown control, only static HTML markup should be used in the interface. Do not include scripts or other constructs that could put your system at risk."

by this line it sounds like it is possible but recommended not to use it.

As suggested by you , I have left my feedback on the article.

Amit Vikram

0 Karma



I also understand the Security Consideration, but have no other option than include a javascript code.
I want to enable HTML email formatting inside a text box with WYSIWYG javascript interface like CKEditor.

Who can advise a solution?

0 Karma


@quzen , I have a similar use case. Would like to allow users to format an HTML email message body, and need to minify and escape the HTML before passing as a parameter. Did you find a solution?

0 Karma


Hello @JTG !


I tried different ways to include javascript into Alert HTML, even asked that question to Documentation team.

But in the end I haven't found a way to do that. Apparently it's just not allowed by the application.


What I finally did is created my own Send Formatted Email addon which allows:

  • select from a list of predefined email templates (base templates with general styling + header and footer)
  • format message body using HTML tags (ex. <h1>, CSS inline styling, etc.)
  • include inline table with results (the same way as in the default Splunk's Send email addon)
  • include inline dashboard screenshot (supports dynamic link with parameters from results)

Configured alert trigger looks like this:


And an email example looks like this:


0 Karma
Get Updates on the Splunk Community!

Splunk Observability Cloud | Unified Identity - Now Available for Existing Splunk ...

Raise your hand if you’ve already forgotten your username or password when logging into an account. (We can’t ...

Index This | How many sides does a circle have?

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

Registration for Splunk University is Now Open!

Are you ready for an adventure in learning?   Brace yourselves because Splunk University is back, and it's ...