logo

NJP

"Show Schema Map" Tools

Import · Oct 14, 2018 · article
(function(){

    var attributes = "table_history=";
    attributes += ",table=" + g_list.tableName;
    attributes += ",show_internal=true";
    attributes += ",show_referenced=true";
    attributes += ",show_referenced_by=true";
    attributes += ",show_extended=true";
    attributes += ",show_extended_by=true";
    attributes += ",table_expansion=";
    attributes += ",spacing_x=60";
    attributes += ",spacing_y=90";
    attributes += "nocontext";

    //setup the proper URL
    var gUrl = new GlideURL("generic_hierarchy_erd.do");

    //add the attributes as a parameter
    gUrl.addParam("sysparm_attributes", attributes);

    //then open in a new tab/window
    g_navigation.open(gUrl.getURL(), "_blank");

})();

Name: Show Schema Map (Old)Table: Global [global]Menu: List HeaderType: ActionOrder: 500,100Active: checkedCondition: gs.hasRole("admin")

Action script:

(function(){
    //setup the proper URL
    var gUrl = new GlideURL("schema_map2.do");

    //add some parameters
    gUrl.addParam("sysparm_stack", "no");
    gUrl.addParam("sysparm_attributes", "table=" + g_list.tableName);

    //then open in a new tab/window
    g_navigation.open(gUrl.getURL(), "_blank");
})();

And the details on the form UI Actions:

Name: Show Schema MapTable: Global [global]Order: 100,000Action name: u_fpc_show_schema_mapActive: checkedShow insert: checkedShow update: checkedClient: checkedForm context menu: checkedHint: Display a schema map of this table in a new tab/windowOnclick: uFpcShowSchemaMap()Condition: gs.hasRole("admin")

Script:

function uFpcShowSchemaMap(){

    var attributes = "table_history=";
    attributes += ",table=" + g_form.tableName;
    attributes += ",show_internal=true";
    attributes += ",show_referenced=true";
    attributes += ",show_referenced_by=true";
    attributes += ",show_extended=true";
    attributes += ",show_extended_by=true";
    attributes += ",table_expansion=";
    attributes += ",spacing_x=60";
    attributes += ",spacing_y=90";
    attributes += "nocontext";

    //setup the proper URL
    var gUrl = new GlideURL("generic_hierarchy_erd.do");

    //add the attributes as a parameter
    gUrl.addParam("sysparm_attributes", attributes);

    //then open in a new tab/window
    g_navigation.open(gUrl.getURL(), "_blank");

}

Name: Show Schema Map (Old)Table: Global [global]Order: 100,000Action name: u_fpc_show_schema_map_oldActive: checkedShow insert: checkedShow update: checkedClient: checkedForm context menu: checkedHint: Display a schema map of this table in a new tab/window (old version of UI Page)Onclick: uFpcShowSchemaMapOld()Condition: gs.hasRole("admin")

Script:

function uFpcShowSchemaMapOld(){
    //setup the proper URL
    var gUrl = new GlideURL("schema_map2.do");

    //add some parameters
    gUrl.addParam("sysparm_stack", "no");
    gUrl.addParam("sysparm_attributes", "table=" + g_form.tableName);

    //then open in a new tab/window
    g_navigation.open(gUrl.getURL(), "_blank");

}

I've attached XML files so you can just import them into your instance. As always, try it out in your company's development instance first, or better yet, your own personal development instance.

Note: Based on an article by Mark Stanger over on the ServiceNowGuru site.

Note: This is an updated version of this article - Showing a Schema Map From a List View

View original source

https://www.servicenow.com/community/developer-blog/quot-show-schema-map-quot-tools/ba-p/2292703