Script to run on list view

saran4
Kilo Guru

How to run a script on List View without onCellEdit. Like in a sense if we load a list view of table the script should run.

Thanks in Advance.

1 ACCEPTED SOLUTION

Hi,

then you can check this link where I shared solution 3 years ago

Display Info message only on list layout

The script section of query business rule will check and show info message only on list and not on form

var index = gs.action.getGlideURI().toString().indexOf('u_tableName_list'); // give the table name here

if(index == -1){
	// it means it is form
}
else{
	gs.addInfoMessage("click on the desired drink to know its nutritional value");
	// it means it is list
}

Regards
Ankur

Regards,
Ankur
✨ Certified Technical Architect  ||  ✨ 9x ServiceNow MVP  ||  ✨ ServiceNow Community Leader

View solution in original post

7 REPLIES 7

Mohit Kaushik
Mega Sage
Mega Sage

You can use Query Business Rules and ACLs. That works when you are loading a list view.

 

Please mark this correct and helpful based on the impact.

 

Thanks,

Mohit Kaushik

Thanks,
Mohit Kaushik
ServiceNow MVP (2023-2025)

Hi Saran,

I can see you have marked my answer as helpful, if your query is resolved then you can mark this answer as correct so that this question can be removed from unanswered thread and other community members can get benefited from the same

 

Thanks,

Mohit Kaushik

Thanks,
Mohit Kaushik
ServiceNow MVP (2023-2025)

Ankur Bawiskar
Tera Patron
Tera Patron

Hi,

you can use before update business rule as well which would run when some field gets updated on list view.

Can you please explain your business requirement so that the correct approach can be shared?

Regards
Ankur

Regards,
Ankur
✨ Certified Technical Architect  ||  ✨ 9x ServiceNow MVP  ||  ✨ ServiceNow Community Leader

 My requiement is I dont wont to run it in form view. I want it run only on list view