How to get record type

gmbroth
Kilo Contributor

Hi. I recently wrote a snippet of server-side Javascript to test for a specific record type by doing something like this:

if (current.aPropertyDefinedInMyExtensionTable) { ... }

While it works for my purposes I got to wondering if there's a better (or more canonical) ServiceNow approach to doing this? Thanks.

4 REPLIES 4

manikorada
ServiceNow Employee

Garry,



Can you tell what exactly you want to check? There might be some inbuilt function for this


postwick
Giga Expert

current.sys_class_name


SandySeegers
Giga Expert

Garry,



Try



current.getTableName()



For cmdb_ci the value is carried in a field.   That's when you can use current.sys_class_name



hope this helps



Sandy


Nick65
Mega Expert

I would look at the TableUtils methods, there is a lot of information you can get about a table with these methods.


TableUtils - ServiceNow Wiki