Join the #BuildWithBuildAgent Challenge! Get recognized, earn exclusive swag, and inspire the ServiceNow Community with what you can build using Build Agent.  Join the Challenge.

Add Info Message

Joshuu
Kilo Sage

Hi All,

 

I need to add an info message at the top of a custom table's list view. 

 

Please assist.

 

Thanks & Regards.

1 ACCEPTED SOLUTION

J Siva
Kilo Patron
Kilo Patron

Hi @Joshuu 
You can achieve this using the before query BR.
Sample:
I took change_request table as an example. So, i've used change_request_list. Update the table name as per your requirement.

JSiva_0-1747654183960.png

JSiva_1-1747654236416.png

 

 

(function executeRule(current, previous /*null when async*/) {
var validate = gs.action.getGlideURI().toString().indexOf('change_request_list'); // Custom table name with the suffix "_list"
if(validate>-1){
	gs.addInfoMessage("Change request list view");
}

})(current, previous);

Hope this helps.
Regards,

Siva

View solution in original post

2 REPLIES 2

J Siva
Kilo Patron
Kilo Patron

Hi @Joshuu 
You can achieve this using the before query BR.
Sample:
I took change_request table as an example. So, i've used change_request_list. Update the table name as per your requirement.

JSiva_0-1747654183960.png

JSiva_1-1747654236416.png

 

 

(function executeRule(current, previous /*null when async*/) {
var validate = gs.action.getGlideURI().toString().indexOf('change_request_list'); // Custom table name with the suffix "_list"
if(validate>-1){
	gs.addInfoMessage("Change request list view");
}

})(current, previous);

Hope this helps.
Regards,

Siva

SuyashJ41731830
Kilo Guru

Hi,
Create new UI script


function addInfoMessage() {
var message = "This is an informational message for the custom table list view.";
var infoContainer = document.createElement('div');
infoContainer.className = 'info-message';
infoContainer.innerHTML = message;
document.querySelector('.list_header').insertAdjacentElement('beforebegin', infoContainer);
}addInfoMessage();
Thanks, and Regards,
Suyash