Show a Table Schema Map from any Form

/, UI actions/Show a Table Schema Map from any Form

Show a Table Schema Map from any Form

T

able schema maps are a very useful tool to aid in visualizing the setup of a table and its relationships to other tables and fields in ServiceNow. This functionality is something that every ServiceNow implementor or admin should be familiar with. Schema maps are documented here in the ServiceNow wiki.

While the schema map is useful, it can also be difficult to navigate to unless you know exactly where to look. The only place in the system to access the schema map is from the ‘Tables and Columns’ module and this is only available to users with the admin role. In this post I’ll show you how you can make the schema map for a given table more accessible by creating a global UI action link that allows you to display the table schema map from any form in the system – for any role you want.

Show Schema Map

Here’s the UI action code. Notice that it’s set on the ‘Global’ table so that it will be available as a link on every form in the system. You’ll also notice that the ‘Condition’ field is set to allow access to only the admin role. You can adjust this as needed to grant access to other users as well. I’ve also added a couple of checks in the script to see if the action is initiated from the dictionary or the label table. In these cases, the popup will pull from the table defined in the dictionary or label entry – rather than the actual ‘sys_dictionary’ or ‘sys_documentation’ tables.

‘Show Schema Map’ UI Action
Name: Show Schema Map
Table: Global
Action name: show_schema_map
Form link: True
Client: True
Onclick: showSchemaMap()
Condition: gs.hasRole(‘admin’)
Script:

function showSchemaMap(){
   //Get the table name
   var tableName = g_form.tableName;
   if(tableName == 'sys_dictionary' || tableName == 'sys_documentation'){
      //Use 'Table' field value for dictionary or labels
      tableName = g_form.getValue('name');
   }
   getTopWindow().popupOpenFocus('schema_map2.do?sysparm_stack=no&sysparm_attributes=table=' + tableName, 'super_schema', 950, 700, '', false, false);
}
By | 2018-07-09T14:59:54-06:00 February 9th, 2012|Categories: System Definition, UI actions|Tags: , , |5 Comments

About the Author:

5 Comments

  1. Josh February 10, 2012 at 11:17 am - Reply

    Where I found this very useful is when review CI’s and trying to see the relationships. This is very nice for that area. thanks!

  2. Ravish February 16, 2012 at 10:13 pm - Reply

    nice

  3. Lakshmi Roy November 2, 2012 at 5:05 am - Reply

    I tried “Show a Table Schema Map from any Form”
    procedure, but its not working. Kindly suggest some other way.

    • Mark Stanger November 2, 2012 at 5:53 am - Reply

      I just tested it on a ServiceNow demo instance and it works fine. This is the only way I know of, so just follow the instructions here.

  4. Jim Coyne December 13, 2012 at 10:26 pm - Reply

    I really like this function and use it all the time. I just posted an article on how to do the same thing from a List view as well – http://community.servicenow.com/blog/jimcoyne/showing-schema-map-list-view

Leave A Comment