Additional info message showing in list view when user is trying to edit columns in list view

Debashish Paul
Tera Guru

Requirement:

  1. Display an info message only in a list view in a 'Problem' table that should contain 'Last Refreshed Time' and 'Next refresh time' this info message should get updated in an interval of 10 minutes - Am able to achieve this requirement using business rule and UI action
  2. Problem currently facing: An additional info message is showing when user is trying to change value in list view, when clicked on cell.

    Need to restrict this 'additional info message' in the list view. Have also attached the screenshots below
    I have highlighted the info messages in Red color that needs to be restricted.
    DebashishPaul_0-1724843114432.png

     

    Business Rule: using Before - Insert, Update and Query 
    script:
     

 

(function executeRule(current, previous /*null when async*/ ) {
    
    var index = gs.action.getGlideURI().toString().indexOf('problem_list');
    if (index > -1) {
        var gdt = new GlideDateTime(); //uses current user session time zone (US/Pacific)
        var usrDateTime = gdt.getDisplayValue();
        var lastRef = usrDateTime.toString().split(" ");
        var addSec = new GlideDateTime();
        addSec.setValue(usrDateTime);
        addSec.addSeconds(600); //10 mins. refresh interval
        var nextRefresh = addSec.toString().split(" ");
        nextRefresh = nextRefresh[1];
        gs.clearMessages();
        gs.addInfoMessage('<b> Last refreshed on: </b>' + lastRef[1] + '&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; <b> Next refresh Time: </b>' + nextRefresh);
    }
})(current, previous);

 


DebashishPaul_1-1724843346610.png

 

 

Need help to fix this asap. Thanks
Regards,
Debashish


1 REPLY 1

Brad Tilton
ServiceNow Employee
ServiceNow Employee

It's likely that when you click into a cell to list edit the UI is querying the DB again which is triggering your BR to run. You might look at the transaction log to see if there's any way to filter out that sort of query from the initial page load.