<?xml version="1.0" encoding="UTF-8"?>
<rss xmlns:content="http://purl.org/rss/1.0/modules/content/" xmlns:dc="http://purl.org/dc/elements/1.1/" xmlns:rdf="http://www.w3.org/1999/02/22-rdf-syntax-ns#" xmlns:taxo="http://purl.org/rss/1.0/modules/taxonomy/" version="2.0">
  <channel>
    <title>topic Re: Why isn't JavaScript executing in my dashboard? I used a XML file. in Dashboards &amp; Visualizations</title>
    <link>https://community.splunk.com/t5/Dashboards-Visualizations/Why-isn-t-JavaScript-executing-in-my-dashboard-I-used-a-XML-file/m-p/348891#M22717</link>
    <description>&lt;P&gt;Hi kamlesh, &lt;/P&gt;

&lt;P&gt;i tried as you said, but nothing happens, the javascript is not executed.&lt;BR /&gt;
and I have nothing in the log.&lt;/P&gt;

&lt;P&gt;thanks&lt;BR /&gt;
Fausto&lt;/P&gt;</description>
    <pubDate>Thu, 12 Oct 2017 15:32:36 GMT</pubDate>
    <dc:creator>fausap</dc:creator>
    <dc:date>2017-10-12T15:32:36Z</dc:date>
    <item>
      <title>Why isn't JavaScript executing in my dashboard? I used a XML file.</title>
      <link>https://community.splunk.com/t5/Dashboards-Visualizations/Why-isn-t-JavaScript-executing-in-my-dashboard-I-used-a-XML-file/m-p/348888#M22714</link>
      <description>&lt;P&gt;Hello,&lt;BR /&gt;
I created a dashboard using this xml file :&lt;/P&gt;

&lt;P&gt;`&lt;BR /&gt;
  FL ERRORS&lt;/P&gt;

&lt;PRE&gt;&lt;CODE&gt;&amp;lt;panel&amp;gt;
  &amp;lt;html&amp;gt;
    &amp;lt;h2&amp;gt;FL ERRS&amp;lt;/h2&amp;gt;

    &amp;lt;p&amp;gt;Select a market:&amp;lt;/p&amp;gt;
    &amp;lt;div id="marketlist"&amp;gt;&amp;lt;/div&amp;gt;&amp;amp;lt;br/&amp;amp;gt;

    &amp;lt;p&amp;gt;Here's the search:&amp;lt;/p&amp;gt;
    &amp;lt;div id="text1"&amp;gt;&amp;lt;/div&amp;gt;
    &amp;lt;div id="tableindex"&amp;gt;&amp;lt;/div&amp;gt;
  &amp;lt;/html&amp;gt;
&amp;lt;/panel&amp;gt;
&lt;/CODE&gt;&lt;/PRE&gt;

&lt;P&gt;`&lt;BR /&gt;
but, it doesn't execute the javascript file, and I have an empty dashboard.&lt;BR /&gt;
Is something missing in my javascript ? &lt;/P&gt;

&lt;P&gt;thanks,&lt;BR /&gt;
Fausto&lt;/P&gt;

&lt;HR /&gt;

&lt;P&gt;The javascript file is : &lt;/P&gt;

&lt;PRE&gt;&lt;CODE&gt;require([
    "splunkjs/mvc",
    "splunkjs/mvc/searchmanager",
    "splunkjs/mvc/dropdownview",
    "splunkjs/mvc/tableview",
    "splunkjs/mvc/textinputview",
    "splunkjs/mvc/simplexml/ready!"
], function(
    mvc,
    SearchManager,
    DropdownView,
    TableView,
    TextInputView
) {

    // Search query is based on the selected index
    var fl_error_search = new SearchManager({
        "id": "fl_error_search",
        "cache": true,
        "earliest_time": "0",
        "latest_time": "$latest$",
        "app": utils.getCurrentApp(),
        "search": mvc.tokenSafe("$searchQuery$")
    });

    // Display an arbitrary list of indexes
    var marketlist = new DropdownView({
        "id":"marketlist",
        "choices": [
            {label: "ITA", value: "ITA"},
            {label: "DEU", value: "DEU"},
            {label: "FRA", value: "FRA"},
            {label: "USA", value: "USA"},
            {label: "&amp;lt;all&amp;gt;", value: "*"}
        ],
        "showClearButton": false,
        "value": mvc.tokenSafe("$marketName$"),
        "el": $("#marketlist")
    }).render();

    // When the $indexName$ token changes, form the search query
    var defaultTokenModel = mvc.Components.get("default");
    defaultTokenModel.on("change:marketName", function(marketName) {
        var newQuery = "|datamodel msc_logger b2c search | fields msc_logger.CORRELATION_ID, msc_logger.MarketCode, MessageText | search msc_logger.CORRELATION_ID!=NULL | transaction msc_logger.CORRELATION_ID maxspan=5m |";
        var newQuery = newQuery + " search msc_logger.MarketCode=" + marketName + " | stats count AS "Total" BY MessageText | sort 3 - Total";
        // Update the $searchQuery$ token value
        defaultTokenModel.set('searchQuery', newQuery);
    });

    // Display the search results
    var textinput1 = new TextInputView({
        "id": "textinput1",
        "value": mvc.tokenSafe("$searchQuery$"),
        "el": $("#text1")
    }).render();


    var tableindex = new TableView({
        "id": "tableindex",
        "managerid": "fl_error_search",
        "pageSize": 5,
        "el": $("#tableindex")
    }).render();
});
&lt;/CODE&gt;&lt;/PRE&gt;</description>
      <pubDate>Tue, 26 Sep 2017 10:54:40 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Dashboards-Visualizations/Why-isn-t-JavaScript-executing-in-my-dashboard-I-used-a-XML-file/m-p/348888#M22714</guid>
      <dc:creator>fausap</dc:creator>
      <dc:date>2017-09-26T10:54:40Z</dc:date>
    </item>
    <item>
      <title>Re: Why isn't JavaScript executing in my dashboard? I used a XML file.</title>
      <link>https://community.splunk.com/t5/Dashboards-Visualizations/Why-isn-t-JavaScript-executing-in-my-dashboard-I-used-a-XML-file/m-p/348889#M22715</link>
      <description>&lt;P&gt;I noticed the xml file for the dashboard is not showing correctly.&lt;/P&gt;

&lt;H2&gt;I hope this will be more readable.&lt;/H2&gt;

&lt;PRE&gt;&lt;CODE&gt;&amp;lt;dashboard script="fl_b2c.js"&amp;gt;
  &amp;lt;label&amp;gt;FL ERRORS&amp;lt;/label&amp;gt;
  &amp;lt;description&amp;gt;&amp;lt;/description&amp;gt;
  &amp;lt;row&amp;gt;
    &amp;lt;panel&amp;gt;
      &amp;lt;html&amp;gt;
        &amp;lt;h2&amp;gt;FL ERRS&amp;lt;/h2&amp;gt;

        &amp;lt;p&amp;gt;Select a market:&amp;lt;/p&amp;gt;
        &amp;lt;div id="marketlist"&amp;gt;&amp;lt;/div&amp;gt;&amp;amp;lt;br/&amp;amp;gt;

        &amp;lt;p&amp;gt;Here's the search:&amp;lt;/p&amp;gt;
        &amp;lt;div id="text1"&amp;gt;&amp;lt;/div&amp;gt;
        &amp;lt;div id="tableindex"&amp;gt;&amp;lt;/div&amp;gt;
      &amp;lt;/html&amp;gt;
    &amp;lt;/panel&amp;gt;
  &amp;lt;/row&amp;gt;
&amp;lt;/dashboard&amp;gt;
&lt;/CODE&gt;&lt;/PRE&gt;</description>
      <pubDate>Tue, 26 Sep 2017 15:24:52 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Dashboards-Visualizations/Why-isn-t-JavaScript-executing-in-my-dashboard-I-used-a-XML-file/m-p/348889#M22715</guid>
      <dc:creator>fausap</dc:creator>
      <dc:date>2017-09-26T15:24:52Z</dc:date>
    </item>
    <item>
      <title>Re: Why isn't JavaScript executing in my dashboard? I used a XML file.</title>
      <link>https://community.splunk.com/t5/Dashboards-Visualizations/Why-isn-t-JavaScript-executing-in-my-dashboard-I-used-a-XML-file/m-p/348890#M22716</link>
      <description>&lt;P&gt;Hi fausap,&lt;/P&gt;

&lt;P&gt;Can you please do minor correction??&lt;/P&gt;

&lt;P&gt;&lt;STRONG&gt;First:&lt;/STRONG&gt;&lt;/P&gt;

&lt;P&gt;replace dashboard tag to form tag,&lt;/P&gt;

&lt;PRE&gt;&lt;CODE&gt;&amp;lt;form script="fl_b2c.js"&amp;gt;

&amp;lt;/form&amp;gt;
&lt;/CODE&gt;&lt;/PRE&gt;

&lt;P&gt;&lt;STRONG&gt;Second:&lt;/STRONG&gt;&lt;/P&gt;

&lt;P&gt;Have you debugged javascript by just making console? &lt;/P&gt;

&lt;PRE&gt;&lt;CODE&gt;console.log("hi");
&lt;/CODE&gt;&lt;/PRE&gt;

&lt;P&gt;It will let you know whether javascript file proper drafted/required or not.&lt;/P&gt;

&lt;P&gt;Thanks&lt;/P&gt;</description>
      <pubDate>Tue, 03 Oct 2017 12:49:33 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Dashboards-Visualizations/Why-isn-t-JavaScript-executing-in-my-dashboard-I-used-a-XML-file/m-p/348890#M22716</guid>
      <dc:creator>kamlesh_vaghela</dc:creator>
      <dc:date>2017-10-03T12:49:33Z</dc:date>
    </item>
    <item>
      <title>Re: Why isn't JavaScript executing in my dashboard? I used a XML file.</title>
      <link>https://community.splunk.com/t5/Dashboards-Visualizations/Why-isn-t-JavaScript-executing-in-my-dashboard-I-used-a-XML-file/m-p/348891#M22717</link>
      <description>&lt;P&gt;Hi kamlesh, &lt;/P&gt;

&lt;P&gt;i tried as you said, but nothing happens, the javascript is not executed.&lt;BR /&gt;
and I have nothing in the log.&lt;/P&gt;

&lt;P&gt;thanks&lt;BR /&gt;
Fausto&lt;/P&gt;</description>
      <pubDate>Thu, 12 Oct 2017 15:32:36 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Dashboards-Visualizations/Why-isn-t-JavaScript-executing-in-my-dashboard-I-used-a-XML-file/m-p/348891#M22717</guid>
      <dc:creator>fausap</dc:creator>
      <dc:date>2017-10-12T15:32:36Z</dc:date>
    </item>
    <item>
      <title>Re: Why isn't JavaScript executing in my dashboard? I used a XML file.</title>
      <link>https://community.splunk.com/t5/Dashboards-Visualizations/Why-isn-t-JavaScript-executing-in-my-dashboard-I-used-a-XML-file/m-p/348892#M22718</link>
      <description>&lt;P&gt;Hi fausap,&lt;/P&gt;

&lt;P&gt;Have you _bump splunk server after changing  javascript ??&lt;BR /&gt;
Login into splunk and hit below URL.&lt;/P&gt;

&lt;P&gt;&lt;A href="http://SPLUNK_SERVER/en-GB/_bump"&gt;http://SPLUNK_SERVER/en-GB/_bump&lt;/A&gt;&lt;/P&gt;

&lt;P&gt;Thanks&lt;/P&gt;</description>
      <pubDate>Fri, 13 Oct 2017 04:35:00 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Dashboards-Visualizations/Why-isn-t-JavaScript-executing-in-my-dashboard-I-used-a-XML-file/m-p/348892#M22718</guid>
      <dc:creator>kamlesh_vaghela</dc:creator>
      <dc:date>2017-10-13T04:35:00Z</dc:date>
    </item>
    <item>
      <title>Re: Why isn't JavaScript executing in my dashboard? I used a XML file.</title>
      <link>https://community.splunk.com/t5/Dashboards-Visualizations/Why-isn-t-JavaScript-executing-in-my-dashboard-I-used-a-XML-file/m-p/348893#M22719</link>
      <description>&lt;P&gt;Hi Kamlesh,&lt;/P&gt;

&lt;P&gt;yes I bumped splunk, but the result is the same.&lt;BR /&gt;
In the debug window in Chrome, in the Console tab I cannot see my message, and also in the Source tab I cannot see my javascript in any folder.&lt;/P&gt;

&lt;P&gt;regards,&lt;BR /&gt;
fausto&lt;/P&gt;</description>
      <pubDate>Fri, 13 Oct 2017 08:35:57 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Dashboards-Visualizations/Why-isn-t-JavaScript-executing-in-my-dashboard-I-used-a-XML-file/m-p/348893#M22719</guid>
      <dc:creator>fausap</dc:creator>
      <dc:date>2017-10-13T08:35:57Z</dc:date>
    </item>
    <item>
      <title>Re: Why isn't JavaScript executing in my dashboard? I used a XML file.</title>
      <link>https://community.splunk.com/t5/Dashboards-Visualizations/Why-isn-t-JavaScript-executing-in-my-dashboard-I-used-a-XML-file/m-p/348894#M22720</link>
      <description>&lt;P&gt;Hi fausap,&lt;BR /&gt;
You have placed you javascript in below path??&lt;/P&gt;

&lt;PRE&gt;&lt;CODE&gt;SPLUNK_HOME/etc/apps/YOUR_APP_FOLDER/appserver/static/fl_b2c.js
&lt;/CODE&gt;&lt;/PRE&gt;

&lt;P&gt;Thanks&lt;/P&gt;</description>
      <pubDate>Fri, 13 Oct 2017 09:10:54 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Dashboards-Visualizations/Why-isn-t-JavaScript-executing-in-my-dashboard-I-used-a-XML-file/m-p/348894#M22720</guid>
      <dc:creator>kamlesh_vaghela</dc:creator>
      <dc:date>2017-10-13T09:10:54Z</dc:date>
    </item>
    <item>
      <title>Re: Why isn't JavaScript executing in my dashboard? I used a XML file.</title>
      <link>https://community.splunk.com/t5/Dashboards-Visualizations/Why-isn-t-JavaScript-executing-in-my-dashboard-I-used-a-XML-file/m-p/348895#M22721</link>
      <description>&lt;P&gt;yes. it's very strange.&lt;/P&gt;</description>
      <pubDate>Fri, 13 Oct 2017 10:18:05 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Dashboards-Visualizations/Why-isn-t-JavaScript-executing-in-my-dashboard-I-used-a-XML-file/m-p/348895#M22721</guid>
      <dc:creator>fausap</dc:creator>
      <dc:date>2017-10-13T10:18:05Z</dc:date>
    </item>
    <item>
      <title>Re: Why isn't JavaScript executing in my dashboard? I used a XML file.</title>
      <link>https://community.splunk.com/t5/Dashboards-Visualizations/Why-isn-t-JavaScript-executing-in-my-dashboard-I-used-a-XML-file/m-p/348896#M22722</link>
      <description>&lt;P&gt;Hi fausap,&lt;/P&gt;

&lt;P&gt;I have found 2 issue in javascript code ..&lt;BR /&gt;
1)&lt;/P&gt;

&lt;PRE&gt;&lt;CODE&gt;// Search query is based on the selected index
     var fl_error_search = new SearchManager({
         "id": "fl_error_search",
         "cache": true,
         "earliest_time": "0",
         "latest_time": "$latest$",
         "app": utils.getCurrentApp(),
         "search": mvc.tokenSafe("$searchQuery$")
     });
&lt;/CODE&gt;&lt;/PRE&gt;

&lt;HR /&gt;

&lt;P&gt;For below line  &lt;CODE&gt;utils&lt;/CODE&gt; is not defined.&lt;/P&gt;

&lt;P&gt;"app": utils.getCurrentApp(),&lt;/P&gt;

&lt;P&gt;2) &lt;/P&gt;

&lt;PRE&gt;&lt;CODE&gt;// When the $indexName$ token changes, form the search query
 var defaultTokenModel = mvc.Components.get("default");
 defaultTokenModel.on("change:marketName", function(marketName) {
     var newQuery = "|datamodel msc_logger b2c search | fields msc_logger.CORRELATION_ID, msc_logger.MarketCode, MessageText | search msc_logger.CORRELATION_ID!=NULL | transaction msc_logger.CORRELATION_ID maxspan=5m |";
     var newQuery = newQuery + " search msc_logger.MarketCode=" + marketName + " | stats count AS "Total" BY MessageText | sort 3 - Total";
     // Update the $searchQuery$ token value
     defaultTokenModel.set('searchQuery', newQuery);
 });
&lt;/CODE&gt;&lt;/PRE&gt;

&lt;P&gt;Concatenation not proper in below line.&lt;/P&gt;

&lt;P&gt;var newQuery = newQuery + " search msc_logger.MarketCode=" + marketName + " | stats count AS &lt;CODE&gt;"Total"&lt;/CODE&gt; BY MessageText | sort 3 - Total";&lt;/P&gt;

&lt;P&gt;Replace It with below line:&lt;/P&gt;

&lt;P&gt;var newQuery = newQuery + " search msc_logger.MarketCode=" + marketName + " | stats count AS \"Total\" BY MessageText | sort 3 - Total";&lt;/P&gt;

&lt;P&gt;Can you please make particular changes and run again ??&lt;/P&gt;</description>
      <pubDate>Fri, 13 Oct 2017 11:38:59 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Dashboards-Visualizations/Why-isn-t-JavaScript-executing-in-my-dashboard-I-used-a-XML-file/m-p/348896#M22722</guid>
      <dc:creator>kamlesh_vaghela</dc:creator>
      <dc:date>2017-10-13T11:38:59Z</dc:date>
    </item>
    <item>
      <title>Re: Why isn't JavaScript executing in my dashboard? I used a XML file.</title>
      <link>https://community.splunk.com/t5/Dashboards-Visualizations/Why-isn-t-JavaScript-executing-in-my-dashboard-I-used-a-XML-file/m-p/348897#M22723</link>
      <description>&lt;P&gt;HI &lt;BR /&gt;
Any update on this?&lt;/P&gt;</description>
      <pubDate>Sat, 04 Nov 2017 17:04:53 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Dashboards-Visualizations/Why-isn-t-JavaScript-executing-in-my-dashboard-I-used-a-XML-file/m-p/348897#M22723</guid>
      <dc:creator>kamlesh_vaghela</dc:creator>
      <dc:date>2017-11-04T17:04:53Z</dc:date>
    </item>
    <item>
      <title>Re: Why isn't JavaScript executing in my dashboard? I used a XML file.</title>
      <link>https://community.splunk.com/t5/Dashboards-Visualizations/Why-isn-t-JavaScript-executing-in-my-dashboard-I-used-a-XML-file/m-p/348898#M22724</link>
      <description>&lt;P&gt;Hello Kamlesh, &lt;/P&gt;

&lt;P&gt;sorry for this delayed response.&lt;BR /&gt;
I did some step forward, but it's still not working.&lt;BR /&gt;
I did the changes you said, and now the js is executed (I can see in the browser console the text I used in the "console.log" command.&lt;/P&gt;

&lt;P&gt;But I have problems with utils class. I did this change in the code:&lt;/P&gt;

&lt;PRE&gt;&lt;CODE&gt;require([
     "splunkjs/mvc",
     "splunkjs/mvc/utils",
     "splunkjs/mvc/searchmanager",
     "splunkjs/mvc/dropdownview",
     "splunkjs/mvc/tableview",
     "splunkjs/mvc/textinputview",
     "splunkjs/mvc/simplexml/ready!"
 ], function(
     mvc,
     SearchManager,
     DropdownView,
     TableView,
     TextInputView
 ) {
&lt;/CODE&gt;&lt;/PRE&gt;

&lt;P&gt;but I got this error in the console :&lt;/P&gt;

&lt;PRE&gt;&lt;CODE&gt;VM288:29 Uncaught ReferenceError: utils is not defined
    at eval (eval at globalEval (common.js:14), &amp;lt;anonymous&amp;gt;:29:17)
    at Object.execCb (eval at module.exports (common.js:137), &amp;lt;anonymous&amp;gt;:1658:33)
    at Module.check (eval at module.exports (common.js:137), &amp;lt;anonymous&amp;gt;:874:51)
    at Module.enable (eval at module.exports (common.js:137), &amp;lt;anonymous&amp;gt;:1151:22)
    at Module.init (eval at module.exports (common.js:137), &amp;lt;anonymous&amp;gt;:782:26)
    at eval (eval at module.exports (common.js:137), &amp;lt;anonymous&amp;gt;:1424:36)
(anonymous) @ VM288:29
execCb @ VM260:1658
check @ VM260:874
enable @ VM260:1151
init @ VM260:782
(anonymous) @ VM260:1424
setTimeout (async)
(anonymous) @ VM260:1763
localRequire @ VM260:1413
requirejs @ VM260:1745
shimmedRequirejsRequire @ common.js:137
(anonymous) @ VM288:5
globalEval @ common.js:14
(anonymous) @ dashboard.js:1
(anonymous) @ common.js:25
fire @ common.js:25
add @ common.js:25
(anonymous) @ common.js:25
each @ common.js:14
(anonymous) @ common.js:25
Deferred @ common.js:25
then @ common.js:25
(anonymous) @ dashboard.js:1
(anonymous) @ common.js:25
fire @ common.js:25
fireWith @ common.js:25
done @ common.js:26
(anonymous) @ common.js:27
XMLHttpRequest.send (async)
(anonymous) @ VM251:1
send @ common.js:27
ajax @ common.js:26
_getScript @ dashboard.js:1
_loadScript @ dashboard.js:1
_loadExtension @ dashboard.js:1
loadScriptExtension @ dashboard.js:1
(anonymous) @ dashboard.js:229
_.each._.forEach @ common.js:27
applyCustomExtension @ dashboard.js:229
(anonymous) @ common.js:25
fire @ common.js:25
add @ common.js:25
(anonymous) @ common.js:25
each @ common.js:14
(anonymous) @ common.js:25
Deferred @ common.js:25
then @ common.js:25
applyDashboardStructure @ dashboard.js:229
later @ common.js:27
setTimeout (async)
(anonymous) @ common.js:27
triggerEvents @ common.js:29
trigger @ common.js:29
set @ common.js:29
parseDashboardXML @ dashboard.js:229
enter @ dashboard.js:229
_handleModeChange @ dashboard.js:225
(anonymous) @ common.js:25
fire @ common.js:25
add @ common.js:25
(anonymous) @ common.js:25
each @ common.js:14
(anonymous) @ common.js:25
Deferred @ common.js:25
then @ common.js:25
handleModeChange @ dashboard.js:225
triggerEvents @ common.js:29
trigger @ common.js:29
set @ common.js:29
(anonymous) @ dashboard.js:225
(anonymous) @ common.js:25
fire @ common.js:25
fireWith @ common.js:25
(anonymous) @ common.js:25
fire @ common.js:25
fireWith @ common.js:25
(anonymous) @ common.js:25
fire @ common.js:25
fireWith @ common.js:25
deferred.(anonymous function) @ common.js:25
(anonymous) @ common.js:47
(anonymous) @ common.js:47
(anonymous) @ common.js:25
fire @ common.js:25
fireWith @ common.js:25
deferred.(anonymous function) @ common.js:25
(anonymous) @ common.js:47
(anonymous) @ common.js:25
fire @ common.js:25
add @ common.js:25
(anonymous) @ common.js:25
each @ common.js:14
(anonymous) @ common.js:25
Deferred @ common.js:25
then @ common.js:25
(anonymous) @ common.js:47
fire @ common.js:25
fireWith @ common.js:25
done @ common.js:26
(anonymous) @ common.js:27
XMLHttpRequest.send (async)
(anonymous) @ VM251:1
send @ common.js:27
ajax @ common.js:26
Backbone.ajax @ common.js:29
Backbone.sync @ common.js:29
sync @ common.js:43
fetch @ common.js:29
fetch @ common.js:43
fetch @ common.js:43
fetch @ common.js:47
(anonymous) @ common.js:47
fire @ common.js:25
fireWith @ common.js:25
deferred.(anonymous function) @ common.js:25
(anonymous) @ common.js:46
options.success @ common.js:29
fire @ common.js:25
fireWith @ common.js:25
done @ common.js:26
(anonymous) @ common.js:27
XMLHttpRequest.send (async)
(anonymous) @ VM251:1
send @ common.js:27
ajax @ common.js:26
Backbone.ajax @ common.js:29
Backbone.sync @ common.js:29
sync @ common.js:43
fetch @ common.js:29
fetch @ common.js:43
fetch @ common.js:43
bootstrapAppLocals @ common.js:46
$whenPageViewDependencies @ common.js:46
$whenPageViewDependencies @ dashboard.js:225
(anonymous) @ dashboard.js:225
(anonymous) @ common.js:25
fire @ common.js:25
add @ common.js:25
(anonymous) @ common.js:25
each @ common.js:14
(anonymous) @ common.js:25
Deferred @ common.js:25
then @ common.js:25
page @ dashboard.js:225
view @ dashboard.js:225
execute @ common.js:29
(anonymous) @ common.js:29
(anonymous) @ common.js:29
_.some._.any @ common.js:27
loadUrl @ common.js:29
start @ common.js:29
exports.start_backbone_history @ common.js:43
(anonymous) @ dashboard.js:1
0 @ dashboard.js:1
__webpack_require__ @ common.js:1
window.webpackJsonp @ common.js:1
(anonymous) @ dashboard.js:1
&lt;/CODE&gt;&lt;/PRE&gt;

&lt;P&gt;How can I include "utils" in the js ? &lt;/P&gt;

&lt;P&gt;thanks,&lt;BR /&gt;
Fausto&lt;/P&gt;</description>
      <pubDate>Tue, 07 Nov 2017 13:14:41 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Dashboards-Visualizations/Why-isn-t-JavaScript-executing-in-my-dashboard-I-used-a-XML-file/m-p/348898#M22724</guid>
      <dc:creator>fausap</dc:creator>
      <dc:date>2017-11-07T13:14:41Z</dc:date>
    </item>
    <item>
      <title>Re: Why isn't JavaScript executing in my dashboard? I used a XML file.</title>
      <link>https://community.splunk.com/t5/Dashboards-Visualizations/Why-isn-t-JavaScript-executing-in-my-dashboard-I-used-a-XML-file/m-p/348899#M22725</link>
      <description>&lt;P&gt;HI&lt;/P&gt;

&lt;P&gt;Just add below code.&lt;/P&gt;

&lt;PRE&gt;&lt;CODE&gt;var utils = require("splunkjs/mvc/utils");
&lt;/CODE&gt;&lt;/PRE&gt;

&lt;P&gt;Have you corrected all changes I'd mentioned for you?&lt;/P&gt;

&lt;P&gt;Thanks&lt;BR /&gt;
Kamlesh&lt;/P&gt;</description>
      <pubDate>Tue, 07 Nov 2017 15:39:46 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Dashboards-Visualizations/Why-isn-t-JavaScript-executing-in-my-dashboard-I-used-a-XML-file/m-p/348899#M22725</guid>
      <dc:creator>kamlesh_vaghela</dc:creator>
      <dc:date>2017-11-07T15:39:46Z</dc:date>
    </item>
    <item>
      <title>Re: Why isn't JavaScript executing in my dashboard? I used a XML file.</title>
      <link>https://community.splunk.com/t5/Dashboards-Visualizations/Why-isn-t-JavaScript-executing-in-my-dashboard-I-used-a-XML-file/m-p/348900#M22726</link>
      <description>&lt;P&gt;Hello Kamlesh,&lt;/P&gt;

&lt;P&gt;I fixed more or less all the issues with the code.&lt;BR /&gt;
This is the final version of js&lt;/P&gt;

&lt;PRE&gt;&lt;CODE&gt;require([
     "splunkjs/mvc",
     "splunkjs/mvc/utils",
     "splunkjs/mvc/searchmanager",
     "splunkjs/mvc/dropdownview",
     "splunkjs/mvc/tableview",
     "splunkjs/mvc/textinputview",
     "splunkjs/mvc/simplexml/ready!"
 ], function(
     mvc,
     SearchManager,
     DropdownView,
     TableView,
     TextInputView
 ) {

     console.log("DEBUG _ HI ");

     // Search query is based on the selected index
     var SearchManager = require("splunkjs/mvc/searchmanager");
     var DropdownView = require("splunkjs/mvc/dropdownview");
     var TextInputView = require("splunkjs/mvc/textinputview");
     var TableView = require("splunkjs/mvc/tableview");

     new SearchManager({
         "id": "fl_error_search",
         "cache": true,
         "earliest_time": "-24h@h",
         "latest_time": "now",
         // "app": Splunk.util.getCurrentApp(),
         "search": mvc.tokenSafe("$searchQuery$")
     });

     console.log("Created SearchManager");

     // Display an arbitrary list of indexes
     var marketName = new DropdownView({
         "id":"marketlist",
         "choices": [
             {label: "ITA", value: "ITA"},
             {label: "DEU", value: "DEU"},
             {label: "FRA", value: "FRA"},
             {label: "USA", value: "USA"},
             {label: "&amp;lt;all&amp;gt;", value: "*"}
         ],
         "showClearButton": false,
         "value": mvc.tokenSafe("$marketName$"),
         "el": $("#marketlist")
     }).render();

     console.log("Created DropdownView");

     // When the $searchQuery$ token changes, form the search query
     var defaultTokenModel = mvc.Components.get("default");
     defaultTokenModel.on("change:marketName", function(marketName) {
         var newQuery = "|datamodel msc_logger b2c search | fields msc_logger.CORRELATION_ID, msc_logger.MarketCode, MessageText | search msc_logger.CORRELATION_ID!=NULL | transaction msc_logger.CORRELATION_ID maxspan=5m |";
         var newQuery = newQuery + " search msc_logger.MarketCode=" + marketName + "| stats count AS \"Total\" BY MessageText | sort 3 - Total";
         // Update the $searchQuery$ token value
         defaultTokenModel.set('searchQuery', newQuery);
     });

     console.log("Created Token");

     // Display the search results
     new TextInputView({
         "id": "textinput1",
         "value": mvc.tokenSafe("$searchQuery$"),
         "el": $("#text1")
     }).render();


     new TableView({
         "id": "tableindex",
         "managerid": "fl_error_search",
         "pageSize": 5,
         "el": $("#tableindex")
     }).render();
 });
&lt;/CODE&gt;&lt;/PRE&gt;

&lt;P&gt;the problem I have is : how to pass the marketName argument to defaultTokenModel ?&lt;BR /&gt;
If I do as above, have this : &lt;/P&gt;

&lt;PRE&gt;&lt;CODE&gt;|datamodel msc_logger b2c search | fields msc_logger.CORRELATION_ID, msc_logger.MarketCode, MessageText | search msc_logger.CORRELATION_ID!=NULL | transaction msc_logger.CORRELATION_ID maxspan=5m | search msc_logger.MarketCode=[object Object]| stats count AS "Total" BY MessageText | sort 3 - Total
&lt;/CODE&gt;&lt;/PRE&gt;

&lt;P&gt;so I suppose I could use a method to get the value of that [object Object].&lt;/P&gt;

&lt;P&gt;thanks,&lt;BR /&gt;
Fausto&lt;/P&gt;</description>
      <pubDate>Tue, 07 Nov 2017 16:22:27 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Dashboards-Visualizations/Why-isn-t-JavaScript-executing-in-my-dashboard-I-used-a-XML-file/m-p/348900#M22726</guid>
      <dc:creator>fausap</dc:creator>
      <dc:date>2017-11-07T16:22:27Z</dc:date>
    </item>
    <item>
      <title>Re: Why isn't JavaScript executing in my dashboard? I used a XML file.</title>
      <link>https://community.splunk.com/t5/Dashboards-Visualizations/Why-isn-t-JavaScript-executing-in-my-dashboard-I-used-a-XML-file/m-p/348901#M22727</link>
      <description>&lt;P&gt;HI&lt;/P&gt;

&lt;P&gt;Can you please revised below code ??&lt;/P&gt;

&lt;PRE&gt;&lt;CODE&gt; // When the $searchQuery$ token changes, form the search query
      var defaultTokenModel = mvc.Components.get("default");
      defaultTokenModel.on("change:marketName", function(e) {
        console.log(e.attributes['marketName'])
          var newQuery = "|datamodel msc_logger b2c search | fields msc_logger.CORRELATION_ID, msc_logger.MarketCode, MessageText | search msc_logger.CORRELATION_ID!=NULL | transaction msc_logger.CORRELATION_ID maxspan=5m |";
          var newQuery = newQuery + " search msc_logger.MarketCode="+e.attributes['marketName']+" | stats count AS \"Total\" BY MessageText | sort 3 - Total";

          console.log(newQuery)
          // Update the $searchQuery$ token value
          defaultTokenModel.set('searchQuery', newQuery);
      });
&lt;/CODE&gt;&lt;/PRE&gt;

&lt;P&gt;Thanks&lt;/P&gt;</description>
      <pubDate>Tue, 07 Nov 2017 16:51:18 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Dashboards-Visualizations/Why-isn-t-JavaScript-executing-in-my-dashboard-I-used-a-XML-file/m-p/348901#M22727</guid>
      <dc:creator>kamlesh_vaghela</dc:creator>
      <dc:date>2017-11-07T16:51:18Z</dc:date>
    </item>
    <item>
      <title>Re: Why isn't JavaScript executing in my dashboard? I used a XML file.</title>
      <link>https://community.splunk.com/t5/Dashboards-Visualizations/Why-isn-t-JavaScript-executing-in-my-dashboard-I-used-a-XML-file/m-p/348902#M22728</link>
      <description>&lt;P&gt;Hi Kamlesh,&lt;/P&gt;

&lt;P&gt;eventually, it works ! &lt;span class="lia-unicode-emoji" title=":slightly_smiling_face:"&gt;🙂&lt;/span&gt;&lt;/P&gt;

&lt;P&gt;thank you very much&lt;BR /&gt;
Fausto&lt;/P&gt;</description>
      <pubDate>Wed, 08 Nov 2017 08:16:43 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Dashboards-Visualizations/Why-isn-t-JavaScript-executing-in-my-dashboard-I-used-a-XML-file/m-p/348902#M22728</guid>
      <dc:creator>fausap</dc:creator>
      <dc:date>2017-11-08T08:16:43Z</dc:date>
    </item>
    <item>
      <title>Re: Why isn't JavaScript executing in my dashboard? I used a XML file.</title>
      <link>https://community.splunk.com/t5/Dashboards-Visualizations/Why-isn-t-JavaScript-executing-in-my-dashboard-I-used-a-XML-file/m-p/348903#M22729</link>
      <description>&lt;P&gt;HI Fausto,&lt;/P&gt;

&lt;P&gt;great..&lt;/P&gt;

&lt;P&gt;Can you please accept answer to close this question and upvote any comment which useful to you.&lt;/P&gt;

&lt;P&gt;Glad to help you&lt;/P&gt;

&lt;P&gt;Thanks&lt;/P&gt;</description>
      <pubDate>Wed, 08 Nov 2017 08:19:38 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Dashboards-Visualizations/Why-isn-t-JavaScript-executing-in-my-dashboard-I-used-a-XML-file/m-p/348903#M22729</guid>
      <dc:creator>kamlesh_vaghela</dc:creator>
      <dc:date>2017-11-08T08:19:38Z</dc:date>
    </item>
  </channel>
</rss>

