How to find scripts which call a script include

Kohei4
Giga Expert

Hi,

I would like to know how to find scripts which call a script include.

I have to change the script include for a reason but I need to check if there is any script calling it which I don't know.

Best Regards,

Kohei

8 REPLIES 8

Tony Chatfield1
Kilo Patron

Hi, Studio has a code search function which may be helpfull.
Otherwise you can manually search the script field intables directly, but there are a lot of places a script include function can be called - hopefully your knowledge of the platform will allow you to exclude some of the possible usage

Hitoshi Ozawa
Giga Sage
Giga Sage

If the script include is only used in some certain type of script like Catalog Client Scripts, just search display the list and use the "for text" search.

For example, following steps will find all occurrence of "GetUserInfo" in Catalog Client Scripts.

  1. Open "Service Catalog" > Catalog Client Scripts"
  2. Search on "for text" for "GetuserInfo".  

 find_real_file.png

Hitoshi Ozawa
Giga Sage
Giga Sage

Can also execute following script to search on client script, scripted REST API, script include.

var searchString = 'GetUserInfo';  // string to search

var tableList = ['sys_script_client', 'sys_ws_definition', 'sys_script_include'];

tableList.forEach(searchText);


function searchText(tableName) {
  var gr = new GlideRecord(tableName);
  gr.addQuery('IR_AND_OR_QUERY', searchString);
  gr.query();
  while (gr.next()) {
    gs.info(tableName + ':' + gr.name);
  }
}

I've a question regarding the code snippet you write 
what's 'IR_AND_OR_QUERY' and how does it works in the code