This is an old revision of the document!
Buttons
List Button
javascript:(function(){var myURL = window.location.href;myURL = decodeURIComponent(myURL);if ( myURL.indexOf("service-now.com/") < 0 && myURL.indexOf('wwwsnow') < 0 ){alert("Looks like you are not on a ServiceNow page.");return;}if ( myURL.indexOf("_list.do") > 0){alert("Looks like you are already in a List View, not a Form.");return;}var indexOfColonSlashSlash = myURL.indexOf("://");var indexOfFunctionPath = myURL.indexOf("/", indexOfColonSlashSlash + 3) + 1;var domainPath;var remainder;var table;var indexOfSysId;var indexOfDotDo;var indexOfDotDoTwo;domainPath = myURL.slice(0, indexOfFunctionPath);remainder = myURL.slice(indexOfFunctionPath);indexOfDotDo = remainder.indexOf(".do?%22);table%20=%20remainder.slice(0,%20indexOfDotDo);if%20(table%20==%20%22nav_to%22){indexOfURI%20=%20remainder.indexOf(%22uri=%22);indexOfDotDoTwo%20=%20remainder.indexOf(%22.do%22,%20indexOfURI);table%20=%20remainder.slice(indexOfURI%20+%205,%20indexOfDotDoTwo);}indexOfSysId%20=%20remainder.indexOf(%22sys_id=%22)%20+%207;indexOfCharAfterSysId%20=%20remainder.indexOf(%22&%22,%20indexOfSysId);if%20(indexOfCharAfterSysId%20==%20-1){sysId%20=%20remainder.slice(indexOfSysId);}else{sysId%20=%20remainder.slice(indexOfSysId,%20indexOfCharAfterSysId);}var%20navToDoPrefix%20=%20%22nav_to.do?uri=/%22;var%20listSuffixAndQueryPrefix%20=%20%22_list.do?sysparm_query=sys_id=%22;var%20completeNewPath%20=%20domainPath%20+%20navToDoPrefix%20+%20table%20+%20listSuffixAndQueryPrefix%20+%20sysId;window.location.href%20=%20completeNewPath;})();
Frame Button
javascript:(function(){var a=window.location.href; if(0<=a.indexOf("navpage.do") ||0<=a.indexOf("nav_to.do") ||0<=a.indexOf("workflow_ide.do")) alert("Looks like you're already inside a frame!"); else if(0<=a.indexOf("service-now.com/") || 0 <= a.indexOf('wwwsnow')){var b=a.indexOf("://"),b=a.indexOf("/",b+3)+1,c=a.slice(0,b),a=a.slice(b);window.location.href=c+"nav_to.do?uri=%22+a}%20else%20alert(%22That%20only%20works%20on%20ServiceNow%20pages.%22)})();
Latest Docs Button
javascript:(function(){var a=location.href;if(a.toString().includes('docs.servicenow.com')){var b=a.indexOf('/concept/')+9;var c=a.indexOf('.html',b)+5;a='https://docs.servicenow.com/csh?topicname=%27+a.substring(b,c)+%27&version=latest%27;navigator.clipboard.writeText(a);alert(%27Latest%20page%20URL%20copied%20to%20clipboard.\nNavigating%20to%20latest%20page%20version.%27);location.href=a}else%20alert(%27This%20does%20not%20appear%20to%20be%20a%20ServiceNow%20Docs%20page.%20This%20button%20only%20works%20for%20pages%20on%20docs.servicenow.com.%27)})();
Debug Now Button
Key Concept - Server - 'Set Redirect URL' Function - Use the Debug Now UI Action to debug scripts from table sysauto_script (“Scheduled Script Executions”) with syntax highlighting and breakpoint capabilities. - Use action.setRedirectURL(current) in a UI Action, to keep the user on the very same web page after any UI action is executed.
Name -Debug Now Table -Scheduled Script Execution [sysauto_script] checked; active, show insert, show update, Form button« Comments -Runs a scheduled script execution script in the current session so that it can be debugged using the script debugger, and also so that messages pushed up to the client may be displayed
Hint -To hit breakpoints, be sure to launch the Script Debugger BEFORE clicking this Debug Now button
Condition 'gs.hasRole(admin)
try{ var evaluator = new GlideScopedEvaluator(); evaluator.evaluateScript(current, 'script'); action.setRedirectURL(current); } catch(e){ gs.addInfoMessage(e); }