Where is the 'BCHMetaData' Script Include referenced in ServiceNow?
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
4 weeks ago - last edited 4 weeks ago
In ServiceNow, I've had to make an amendment to the OOTB Script Include 'BCHMetaData' so that the 'Create sub-capability' action is removed.. However, I don't feel comfortable doing this and would rather make a clone of the Script Include.
However, I need to know where the OOTB Script Include 'BCHMetaData' is currently be used or referenced so that I can make the amendments in those areas too to use my clone.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
4 weeks ago
That is fine, but it is possible to be used where you may not expect.
Try using this script to find where it is referenced in which table:
var searchText = "BCHMetaData";
var tables = [
"sys_script_include",
"sys_script",
"sys_ui_action",
"sys_ui_page",
"sys_processor",
"sys_ui_policy",
"sys_client_script",
"sys_security_acl",
"sys_security_acl_script",
"sys_transform_map",
"sysauto_script",
"sys_trigger",
"sys_hub_action_type_definition"
];
for (var i = 0; i < tables.length; i++) {
var table = tables[i];
var dict = new GlideRecord("sys_dictionary");
dict.addQuery("name", table);
dict.addQuery("internal_type", "CONTAINS", "script");
dict.query();
while (dict.next()) {
var field = dict.element.toString();
var gr = new GlideRecord(table);
if (!gr.isValidField(field))
continue;
gr.addQuery(field, "CONTAINS", searchText);
gr.query();
while (gr.next()) {
gs.print(
table + "." + field +
" -> " + gr.getDisplayValue() +
" [" + gr.getUniqueValue() + "]"
);
}
}
}
I checked in my PDI using other Script include and it worked well.
Please Accept this response as Solution if it assisted you with your question & Mark this response as Helpful.
Kind Regards,
Ehab Pilloor
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
3 hours ago
Hello @matthew_hughes ! This is being used to fetch the metadata for the business capability page. The Scripted REST Resource(sys_ws_operation table) has the record getCapabilityMetadata that uses the methods from this script include. Please check the attached screenshots for more info.
Important Note: As suggested by other users, we highly recommend not to make any customizations to the OOB shipped code and features, as it might cause potential issues in the existing functionalities. Thanks!