Rename any script include with a duplicate name with a unique name.

rachelturkariga
Giga Contributor

Hi Team,

Does any one have an idea on how we replace duplicate names with script include.

For Example : 

Name: msteams  i have see this script include twice.

1)How do i fix this.

2)How do i know if this script include is used either in business rule or client script.

 

Thank You in Advance.

2 REPLIES 2

Arav
Tera Guru
Tera Guru

Hi,

Consider the following.

a. Launch "System Applications > Studio"

b. In Studio, select any application

c. Select "Search > Code Search"

d. Enter the search term (Script include name), check "Search in all applications", and click "Search"

This will list all scripts that reference the Script include.

Please mark the response as correct if this has helped address the issue.

Thanks,

Arav

 

MrMuhammad
Giga Sage

Hi,

1) You can do a code search to find the occurrences of script include. It will give you well understanding of where it's been referenced but not all.

Code Search | Article

2) Try below script given by Hitoshi Ozawa that find all the occurrences of a string.

var searchString = 'msteams';  // class or method name

var tableList = ['sys_script_client','sys_ui_policy','sys_ui_script','catalog_ui_policy','sys_widgets','sys_ui_page',
'sys_script','sys_script_include','sysevent_script_action','sysauto','sys_script_fix',
'sys_script_email','sys_installation_exit','sp_widget','sys_security_acl','sys_transform_script',
'sys_transform_entry','sys_ui_action','sys_ui_page','sys_ui_macro','sys_ws_definition','sys_script_validator'];

tableList.forEach(searchText);


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

Reference: https://community.servicenow.com/community?id=community_question&sys_id=166c43f0dbf4a81011762183ca96...

Hope that helps!

Regards,

Muhammad

Regards,
Muhammad