<?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: A custom JavaScript error caused an issue loading your dashboard. See the developer console for more details. in Dashboards &amp; Visualizations</title>
    <link>https://community.splunk.com/t5/Dashboards-Visualizations/A-custom-JavaScript-error-caused-an-issue-loading-your-dashboard/m-p/696946#M57129</link>
    <description>&lt;P&gt;Hi&amp;nbsp;&lt;a href="https://community.splunk.com/t5/user/viewprofilepage/user-id/6367"&gt;@bowesmana&lt;/a&gt;&amp;nbsp;,&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;I mean to ask what part of the js file defines the JS error in the UI. I have other files as well that have different functionalities but they do not have the util/console part but still throw the same error. How do I identify those parts in the JS file?&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Regards,&lt;/P&gt;&lt;P&gt;Pravin&lt;/P&gt;</description>
    <pubDate>Wed, 21 Aug 2024 10:29:06 GMT</pubDate>
    <dc:creator>_pravin</dc:creator>
    <dc:date>2024-08-21T10:29:06Z</dc:date>
    <item>
      <title>A custom JavaScript error caused an issue loading your dashboard. See the developer console for more details.</title>
      <link>https://community.splunk.com/t5/Dashboards-Visualizations/A-custom-JavaScript-error-caused-an-issue-loading-your-dashboard/m-p/696743#M57100</link>
      <description>&lt;P&gt;Hi,&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;I get this error in our Splunk dashboards once I migrated splunk to version 9.2.2&lt;/P&gt;&lt;P&gt;I was able to bypass the error in the dashboards by updating &lt;STRONG&gt;internal_library_settings&amp;nbsp;&lt;/STRONG&gt;and unrestricting the library requirements. But this increases the risk/vulnerability of the environment.&amp;nbsp;&lt;/P&gt;&lt;LI-CODE lang="markup"&gt;require(['jquery', 'underscore', 'splunkjs/mvc', 'util/console'], function($, _, mvc, console) {
    function setToken(name, value) {
        console.log('Setting Token %o=%o', name, value);
        var defaultTokenModel = mvc.Components.get('default');
        if (defaultTokenModel) {
            defaultTokenModel.set(name, value);
        }
        var submittedTokenModel = mvc.Components.get('submitted');
        if (submittedTokenModel) {
            submittedTokenModel.set(name, value);
        }
    }
    $('.dashboard-body').on('click', '[data-set-token],[data-unset-token],[data-token-json]', function(e) {
        e.preventDefault();
        var target = $(e.currentTarget);
        var setTokenName = target.data('set-token');
        if (setTokenName) {
            setToken(setTokenName, target.data('value'));
        }
        var unsetTokenName = target.data('unset-token');
        if (unsetTokenName) {
            setToken(unsetTokenName, undefined);
        }
        var tokenJson = target.data('token-json');
        if (tokenJson) {
            try {
                if (_.isObject(tokenJson)) {
                    _(tokenJson).each(function(value, key) {
                        if (value == null) {
                            // Unset the token
                            setToken(key, undefined);
                        } else {
                            setToken(key, value);
                        }
                    });
                }
            } catch (e) {
                console.warn('Cannot parse token JSON: ', e);
            }
        }
    });
});&lt;/LI-CODE&gt;&lt;P&gt;The above code is the one that I have for one of the dashboards. Not sure how to check the jQuery version of the code, but if there is some help to fix the above code that meets the requirements of Jquery 3.5, I'll implement the same for other code as well.&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Thanks,&lt;/P&gt;&lt;P&gt;Pravin&lt;/P&gt;</description>
      <pubDate>Mon, 19 Aug 2024 16:09:42 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Dashboards-Visualizations/A-custom-JavaScript-error-caused-an-issue-loading-your-dashboard/m-p/696743#M57100</guid>
      <dc:creator>_pravin</dc:creator>
      <dc:date>2024-08-19T16:09:42Z</dc:date>
    </item>
    <item>
      <title>Re: A custom JavaScript error caused an issue loading your dashboard. See the developer console for more details.</title>
      <link>https://community.splunk.com/t5/Dashboards-Visualizations/A-custom-JavaScript-error-caused-an-issue-loading-your-dashboard/m-p/696788#M57109</link>
      <description>&lt;P&gt;That looks like it's the token setter JS from the dashboard examples.&lt;/P&gt;&lt;P&gt;However, you have&lt;/P&gt;&lt;LI-CODE lang="markup"&gt;require(['jquery', 'underscore', 'splunkjs/mvc', 'util/console'], function($, _, mvc, console) {&lt;/LI-CODE&gt;&lt;P&gt;whereas the original is&lt;/P&gt;&lt;LI-CODE lang="markup"&gt;require(['jquery', 'underscore', 'splunkjs/mvc'], function($, _, mvc) {&lt;/LI-CODE&gt;&lt;P&gt;have you tried removing the util/console and console declarations&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Tue, 20 Aug 2024 02:20:32 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Dashboards-Visualizations/A-custom-JavaScript-error-caused-an-issue-loading-your-dashboard/m-p/696788#M57109</guid>
      <dc:creator>bowesmana</dc:creator>
      <dc:date>2024-08-20T02:20:32Z</dc:date>
    </item>
    <item>
      <title>Re: A custom JavaScript error caused an issue loading your dashboard. See the developer console for more details.</title>
      <link>https://community.splunk.com/t5/Dashboards-Visualizations/A-custom-JavaScript-error-caused-an-issue-loading-your-dashboard/m-p/696829#M57114</link>
      <description>&lt;P&gt;Hi&amp;nbsp;&lt;a href="https://community.splunk.com/t5/user/viewprofilepage/user-id/6367"&gt;@bowesmana&lt;/a&gt;&amp;nbsp;,&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Thanks for the response. I don't know JS, so I am checking with the communty if someone else had the same issues and might have some generic solution that might help me fix the xml.&lt;/P&gt;&lt;P&gt;I'll tried your solution and it worked.&lt;/P&gt;&lt;P&gt;Could you please explain what it really does so that I would get idea ?&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Thanks,&lt;/P&gt;&lt;P&gt;Pravin&lt;/P&gt;</description>
      <pubDate>Tue, 20 Aug 2024 11:30:31 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Dashboards-Visualizations/A-custom-JavaScript-error-caused-an-issue-loading-your-dashboard/m-p/696829#M57114</guid>
      <dc:creator>_pravin</dc:creator>
      <dc:date>2024-08-20T11:30:31Z</dc:date>
    </item>
    <item>
      <title>Re: A custom JavaScript error caused an issue loading your dashboard. See the developer console for more details.</title>
      <link>https://community.splunk.com/t5/Dashboards-Visualizations/A-custom-JavaScript-error-caused-an-issue-loading-your-dashboard/m-p/696922#M57121</link>
      <description>&lt;P&gt;It's a really useful piece of JS that allows you to put HTML buttons into your dashboard that can set and unset tokens in use in the dashboard.&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Wed, 21 Aug 2024 06:40:56 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Dashboards-Visualizations/A-custom-JavaScript-error-caused-an-issue-loading-your-dashboard/m-p/696922#M57121</guid>
      <dc:creator>bowesmana</dc:creator>
      <dc:date>2024-08-21T06:40:56Z</dc:date>
    </item>
    <item>
      <title>Re: A custom JavaScript error caused an issue loading your dashboard. See the developer console for more details.</title>
      <link>https://community.splunk.com/t5/Dashboards-Visualizations/A-custom-JavaScript-error-caused-an-issue-loading-your-dashboard/m-p/696923#M57122</link>
      <description>&lt;P&gt;For example&lt;/P&gt;&lt;LI-CODE lang="markup"&gt;      &amp;lt;html&amp;gt;
        &amp;lt;button data-token-json="{&amp;amp;quot;my_token&amp;amp;quot;:&amp;amp;quot;My Value&amp;amp;quot;"&amp;gt;Set the my_token token to My Value&amp;lt;/button&amp;gt;
      &amp;lt;/html&amp;gt;&lt;/LI-CODE&gt;&lt;P&gt;and you can then use the $my_token$ elsewhere in your dashboard.&lt;/P&gt;</description>
      <pubDate>Wed, 21 Aug 2024 06:43:31 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Dashboards-Visualizations/A-custom-JavaScript-error-caused-an-issue-loading-your-dashboard/m-p/696923#M57122</guid>
      <dc:creator>bowesmana</dc:creator>
      <dc:date>2024-08-21T06:43:31Z</dc:date>
    </item>
    <item>
      <title>Re: A custom JavaScript error caused an issue loading your dashboard. See the developer console for more details.</title>
      <link>https://community.splunk.com/t5/Dashboards-Visualizations/A-custom-JavaScript-error-caused-an-issue-loading-your-dashboard/m-p/696946#M57129</link>
      <description>&lt;P&gt;Hi&amp;nbsp;&lt;a href="https://community.splunk.com/t5/user/viewprofilepage/user-id/6367"&gt;@bowesmana&lt;/a&gt;&amp;nbsp;,&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;I mean to ask what part of the js file defines the JS error in the UI. I have other files as well that have different functionalities but they do not have the util/console part but still throw the same error. How do I identify those parts in the JS file?&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Regards,&lt;/P&gt;&lt;P&gt;Pravin&lt;/P&gt;</description>
      <pubDate>Wed, 21 Aug 2024 10:29:06 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Dashboards-Visualizations/A-custom-JavaScript-error-caused-an-issue-loading-your-dashboard/m-p/696946#M57129</guid>
      <dc:creator>_pravin</dc:creator>
      <dc:date>2024-08-21T10:29:06Z</dc:date>
    </item>
    <item>
      <title>Re: A custom JavaScript error caused an issue loading your dashboard. See the developer console for more details.</title>
      <link>https://community.splunk.com/t5/Dashboards-Visualizations/A-custom-JavaScript-error-caused-an-issue-loading-your-dashboard/m-p/697007#M57143</link>
      <description>&lt;P&gt;We you'll have to look on a case by case basis - there are some use cases where objects are defined in first JS load and then they can be reloaded, but the same object already exists the second time around.&lt;/P&gt;</description>
      <pubDate>Thu, 22 Aug 2024 00:51:55 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Dashboards-Visualizations/A-custom-JavaScript-error-caused-an-issue-loading-your-dashboard/m-p/697007#M57143</guid>
      <dc:creator>bowesmana</dc:creator>
      <dc:date>2024-08-22T00:51:55Z</dc:date>
    </item>
  </channel>
</rss>

