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.
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.
Name: Show Schema Map
Table: Global
Action name: show_schema_map
Form link: True
Client: True
Onclick: showSchemaMap()
Condition: gs.hasRole(‘admin’)
Script:
//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);
}
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!
nice
I tried “Show a Table Schema Map from any Form”
procedure, but its not working. Kindly suggest some other way.
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.
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