How to make GlideRecord point to current record table

F_bio Santos
Kilo Sage

Hi everyone is there any way to make a GlideRecord that will get the table of the current record with a BR ?

Basically what Im trying to do is:

We have a field in the record producer that has a default value with will populate a field on the table, but when this default value changes we want all the previous records that have been created with the old value change to the new one, the problem is that this field exist's in many tables, so I need to get the table of the record that the default value got changed.

1 ACCEPTED SOLUTION

Manikmodi16
Tera Guru

Hi,

 

You can use GlideElement class method getTableName() in order to return the name of the table on which the field resides.

 

For example:

if (current.approver.getTableName() == "sysapproval_approver"){       //Example to use getTableName() method
          return true;
}

 

Refer to this link for more information on the method - GlideElement | ServiceNow Developers

 

Thanks,

Manik Modi

 

Please mark my reply as the solution if you find this helpful. Thanks!

View solution in original post

2 REPLIES 2

Vishal Birajdar
Giga Sage

Hi @F_bio Santos 

 

If possible can you provide some more information please...

 

 

Vishal Birajdar
ServiceNow Developer

I know one thing, and that is that I know nothing.
- Socrates

Manikmodi16
Tera Guru

Hi,

 

You can use GlideElement class method getTableName() in order to return the name of the table on which the field resides.

 

For example:

if (current.approver.getTableName() == "sysapproval_approver"){       //Example to use getTableName() method
          return true;
}

 

Refer to this link for more information on the method - GlideElement | ServiceNow Developers

 

Thanks,

Manik Modi

 

Please mark my reply as the solution if you find this helpful. Thanks!