can we get which table the glide record is pointing to?

ryadavalli
Tera Expert

Hi,

Can we user gr.sys_class_name before a insert, just for debug purposes?

Thanksm

7 REPLIES 7

With the code you submitted above, gr. will only point to the incident table, it will reference no other table in any way. If somehow, someway it ever did, with that code above, we would ALL be in serious trouble.


Your use case is unclear; however here is how I do it:



Server side you have the property:


current.sys_class_name;



For client side you have the method:


g_form.getTableName()


odijk
Giga Expert

the sys_class_name is a field that is only available on extended tables (and their base table, where it is defined). This means it will not always work. I also don't know exactly when it is set: upon gr.initialize() or after, but the code below may help:

In general, if you want to know information that is populated via default values, you can use the following setup:

var gr = new GlideRecord(<table_name>);

gr.newRecord(); // this will set all the default values

gr.<do your stuff>

gs.info('If I am an extended able: the table name will show here: ' + gr.sys_class_name);

gr.insert()