Query Table from Chrome Bookmark Bar
I found myself repeating common queries over and over in ServiceNow. Often times I would want to open a new tab for this search, as it would be a quick one-off, and didn't want to disturb my other tabs. Lately I've been querying the sys_user table for people by name, so I would middle-click (open in new tab) a bookmark for the sys_user table, or type sys_user.LIST (<-- all caps for new tab). Once that table loaded, I would then go to the search box above the Name column, and type or paste the name I'm looking for.
Do this several hundred times and you'll get pretty quick at it. But then you'll start asking yourself, can't it be quicker? Maybe using the Global Search to query the name? Better hope for an exact match there.....
Enter, JavaScript enabled Chrome Bookmarks. With Chrome you can save a bookmark that executes any JavaScript function you want. And for my needs, it can be done very simply. All you have to do is save a bookmark, then edit it and change the url to "javascript: your_code_here;"
To query the sys_user table, the below snippet will open a prompt for the query term. If you click cancel, nothing will happen. An empty field will just open the sys_user table. But if you enter a term, it will open a new tab and query the sys_user table with what you entered!
javascript: var name=prompt("Name");if(name.toString()!='null'){var url='https://yourinstance.service-now.com/sys_user_list.do';if(name!='')url+='?sysparm_query=nameSTARTSWITH'+name;window.open(url);}
This one will navigate to the Global Search. Very handy to open a ticket number if you have the exact INC, or for any other search. It ignores a Cancel or empty query, as that wouldn't be beneficial.
javascript: var search=prompt("Search");if(search.toString()!='null' && search!=''){var url='https://yourinstance.service-now.com/nav_to.do?uri=text_search_exact_match.do%3Fsysparm_search%3D'+search;window.open(url);}
The possibilities are endless with this. I hope these examples spark your creativity and you can save some mouse-clicks!
https://www.servicenow.com/community/developer-articles/query-table-from-chrome-bookmark-bar/ta-p/2327649