Not applicable

In Service Portal, many libraries are included and loaded by default in all pages.To avoid overloading the platform with duplicate libraries, first consult the existing.

There is a trick to recover it.

1. Inspect the code of the page

2. Search the DOM for the string: "/scripts/js_includes_sp.jsx"

find_real_file.png

3. Open the path of this JSX file in the browser (ex: https://xxxx.service-now.com/scripts/js_includes_sp.jsx?v=11-22-2017_2104&lp=Fri_Dec_15_13_37_09_CET...).

The JS code is displayed :

/*! RESOURCE: /scripts/js_includes_sp.js */

/*! RESOURCE: /scripts/js_includes_sp_deps.js */

/*! RESOURCE: /scripts/lib/jquery/jquery-2.1.js */

(function( global, factory ) {

if ( typeof module === "object" && typeof module.exports === "object" ) {

module.exports = global.document ?

factory( global, true ) :

function( w ) {

if ( !w.document ) {

}

...

To retrieve the scripts list, isolate all lines / *! RESOURCE: ... * / .

In Notepad ++ :

4. Do "Ctrl" + "F"

5. Search : "/ *! RESOURCE "

6. Click on the "Mark" tab

7. Check the "Bookmark line" cache

8. Click on "Mark All"

All lines are marked

9. Click on "Search> Bookmark> Copy Bookmarked Lines"

10. Open a new file and paste the result

11. It just remains to delete "/ *! RESOURCE: "and" * / "(Find + Replace All)

We get the final list :

/scripts/js_includes_sp.js

/scripts/js_includes_sp_deps.js

/scripts/lib/jquery/jquery-2.1.js

/scripts/angular_includes_no_min.1.5.11.js

...

Before include a new JS library (ex : lodash), search it in this list 😉

Regards

Comments
Not applicable

Other possibility in command line :

{ curl -s https://<instance>.service-now.com/scripts/js_includes_sp.jsx ;  curl -s https://<instance>.service-now.com/scripts/js_includes_sp_libs.jsx ; } | grep "RESOURCE:" |sort |uniq -c |sort -nr | grep -v "js_includes" | cat -n
Deepak Ingale1
Mega Sage

Thank you for sharing this wonderful information !

Steve Kelly
Mega Sage

@Community Alumsdo you know if the events that are broadcast in /scripts/js_includes_sp.jsx are accessible from a widget? We are trying to wait on dismissal of a UI Notification banner before taking an action.

Not applicable

Sorry @Steve Kelly , I don't know which JS event you can listen. 

Version history
Last update:
‎12-22-2017 02:31 AM
Updated by:
Community Alums