We're reclaiming inactive PDIs to keep them available for active builders. Learn what's changing, who's affected, and how to protect your work. Read More

Where is the 'BCHMetaData' Script Include referenced in ServiceNow?

matthew_hughes
Kilo Sage

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.

5 REPLIES 5

@matthew_hughes,

 

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