Dashboards & Visualizations

Was showing time of last update of dashboard in 6.4 using javascript. Stopped working in 6.5. Need suggestion on how to get working in 6.5.

simpkins1958
Contributor

The following XML/Javascript was working in 6.4 to update the lastupdatedtime id. In 6.5 the javascript is now only being called on initial page load. Anyway to get the javascript code called on every refresh like it was in 6.5? Thanks.

Simple XML:

<form refresh="300" script="pageinit.js,system_summary_widths.js">
  <label>System Summary</label>
  <fieldset submitButton="false">
    <html>
        Last updated: <span id="lastupdatetime"></span>
    </html>

Javascript:

require([
    "splunkjs/mvc",
    "splunkjs/mvc/simplexml/ready!"
], function(mvc) {

    var d = new Date();
    var n = d.toLocaleString();
    document.getElementById("lastupdatetime").innerHTML = n;
});
0 Karma

simpkins1958
Contributor

Change my javascript to update the time when one of the searches on the page finishes.

require([
    "splunkjs/mvc",
    "splunkjs/mvc/simplexml/ready!"
], function(mvc) {

    var mySearch = splunkjs.mvc.Components.getInstance("baseSearch_wifi_bytes");

     mySearch.on('search:done', function(properties) {
        var currentDateTime = new Date();
        var currentDateTimeLocalizedString = currentDateTime.toLocaleString();
        document.getElementById("lastupdatetime").innerHTML = currentDateTimeLocalizedString;
    }); 
});
0 Karma
Get Updates on the Splunk Community!

Index This | Why did the turkey cross the road?

November 2025 Edition  Hayyy Splunk Education Enthusiasts and the Eternally Curious!   We’re back with this ...

Enter the Agentic Era with Splunk AI Assistant for SPL 1.4

  &#x1f680; Your data just got a serious AI upgrade — are you ready? Say hello to the Agentic Era with the ...

Feel the Splunk Love: Real Stories from Real Customers

Hello Splunk Community,    What’s the best part of hearing how our customers use Splunk? Easy: the positive ...