Yusuf5
Tera Expert

I enjoy using this, that's why I wanted to share it. You ServiceNow Developers might find it useful.

In order to get the table details and descendants for underlying form, I have to go to Configure and then Table as bellow.

find_real_file.png

However, I just get to the table name for this form for descendant tables I have to go all the way.

This process is a bit cumbersome.

I have developed a basic thing to get the table name and descendants using the global UI Action for the underlying form as follows.

In this sample, I used the CMDB Linux Server.

find_real_file.png

The result:

find_real_file.png

When clicking on the table names, it navigates to table description.

Here are the development details.

  1. Create two Script Include files

TableUtilsCustom.js                     Runs on the server

TableUtilsCustomAjax.js             Client callable

  1. Create a global UI Action.

find_real_file.png

Script:

function getTableName() {

  try {

    var table_name = g_form.getTableName();

    copyToClipboard(table_name);

    var gra = new GlideAjax("TableUtilsCustomAjax");

    gra.addParam("sysparm_name", "getHierarchy");

    gra.addParam("sysparm_table_name", table_name);

    gra.getXMLWait();

    var result = gra.getAnswer();

    var gdw = new GlideModal("glide_warn", false, 400);

    gdw.setTitle(getMessage('About table'));

    gdw.setPreference('title', result);

    gdw.render();

  } catch (ex) {

    g_form.addErrorMessage(ex);

  }

}

 

Include files are attached.

Feel free to ask any question.

Hope you enjoy it.

Regards,

Yusuf

Comments
Shiva Thomas
Kilo Sage

Hi Yusuf!

Thank you for sharing this nice trick! I like it a lot. 😄  ^_^

Maybe this can also be published on the Share website.


Best regards from Switzerland
Shiva :¬,

If this reply assisted you, please consider marking it 👍Helpful.
This enables other customers to learn from this thread.

 

Yusuf5
Tera Expert
Version history
Last update:
‎08-07-2019 02:29 PM
Updated by: