logo

NJP

Forms layout documentation — Database View style

Import · Jan 26, 2018 · article

Have you ever struggled with the task of documenting the layout and content of the forms used in your ServiceNow instance? Did you find it time consuming and really boring? Wouldn't it be great if you could just pull out a list of every layout of every view of every form in you instance — instantly? Well, you can… by using a database view.

Follow these steps to create the Database View needed.

Create a database view

To start with you need a new database view.

  • Select System UI/Database View in the Navigator
  • Click New
  • Enter the following information
    • Name: u_forms_documentation
    • Label: Forms Documentation
    • Description: Database View to collect layout of forms
  • Save

image

Add Tables to database view

Then you need to add tables to the view.

  • In the View Tables section click New
  • Enter the following information:
    • Table: Form Section [sys_ui_section]
    • Variable prefix: Section
    • Order: 100
    • Click Submit

image

Add another table.

  • In the View Tables section click New
  • Enter the following information:
    • Table: Section Element [sys_ui_element]
    • Variable prefix: Section
    • Order: 200
  • Click Submit

image

The database view should now contain 2 tables and look like this:

image

Add fields from tables

The fields to be display in the database view needs to be defined for each table.

  • Click the sys_ui_section table
  • In the View Fields section click New
  • Select the following fields and click submit for each field and then repeat for the next.

image

  • Click update to close the View Table for sys_ui_section.
  • Click the sys_ui_element table
  • In the View Fields section click New
  • Select the following fields and click submit for each field and then repeat for the next.
    • element
    • position
    • type
    • sys_ui_section

image

Do not close this view.

Map tables by adding Clause

The two tables in the Database View needs to be mapped together using a Where Clause.

  • Open the sys_ui_element view table if you closed it
  • Add the following statement
    • Where Clause: element_sys_ui_section = section_sys_id
  • Click update to close view

image

Adjust list view

In order to have the Database View present the data properly in a useful manner the list view needs to be adjusted.

  • Open the newly created Database view
  • Click the "Try it" related link on the form

image

  • Use the Cogwheel to personalize the list

image

  • Add the columns in the following order
    • Table
    • View
    • Caption
    • Element
    • Postion
    • Type
  • Click OK

Use the Database View

The Database View is now ready to instantly display a summary of the layouts of your forms. The columns represent the following information.

  • Table: The table used by the form
  • View: The View the layout represents
  • Caption: The name of the sections on the form
  • Element: The fields, formatters, separators of the form
  • Position: The position of the element within a section
  • Type: The type of element

image

The Database View benefits from grouping and filtering.

Filter a specific table to show forms for this table and then group the Views to separate the layouts for each View.

View original source

https://www.servicenow.com/community/developer-articles/forms-layout-documentation-database-view-style/ta-p/2329892