The CreatorCon Call for Content is officially open! Get started here.

Problem with GlideRecord.setTableName

markherring
Kilo Expert

We are attempting to read the full list of table names using the SOAP API but not all tables are returned.  In the System Error Log we see this

GlideRecord.setTableName - empty table name: org.mozilla.javascript.EvaluatorException: GlideRecord.setTableName - empty table name:

org.mozilla.javascript.DefaultErrorReporter.runtimeError(DefaultErrorReporter.java:77)

Any suggestions on what could be causing this would be most welcome.

Current platform Jakarta patch 3.

1 ACCEPTED SOLUTION

dvp
Mega Sage

There are some tables that needs to be excluded.

Also there is a method called isValid which return whether it is a valid table or not

 

Here is the script that returns all the valid tables

var tble = new GlideRecord('sys_db_object');
tble.addEncodedQuery('sys_update_nameISNOTEMPTY^name!=v_wf_validation_report^nameISNOTEMPTY');
tble.query();
var count = 0;
while(tble.next()){
	
	
	var gr = new GlideRecord(tble.name);
	if(gr.isValid()){
		
		gr.query();
		
			gs.log('Table Name: ' + tble.name);
			
			count++;
	}
}

gs.log('Total Tables:' +count);

View solution in original post

4 REPLIES 4

Alberto Consonn
ServiceNow Employee
ServiceNow Employee

Hi,

have a look here:

https://hi.service-now.com/kb_view.do?sysparm_article=KB0647564

It has been fixed in Kingston.

If I have answered your question, please mark my response as correct so that others with the same question in the future can find it quickly and that it gets removed from the Unanswered list.

Thank you

Cheers
Alberto

dvp
Mega Sage

There are some tables that needs to be excluded.

Also there is a method called isValid which return whether it is a valid table or not

 

Here is the script that returns all the valid tables

var tble = new GlideRecord('sys_db_object');
tble.addEncodedQuery('sys_update_nameISNOTEMPTY^name!=v_wf_validation_report^nameISNOTEMPTY');
tble.query();
var count = 0;
while(tble.next()){
	
	
	var gr = new GlideRecord(tble.name);
	if(gr.isValid()){
		
		gr.query();
		
			gs.log('Table Name: ' + tble.name);
			
			count++;
	}
}

gs.log('Total Tables:' +count);

FIKRI BENBRAHIM
Kilo Guru

Hello,

 

   After upgrade to Jakarta upgrade, accessing a record producer in the Service Portal generates an error in the server logs: "GlideRecord.setTableName - empty table name".

   Check this link that describes issues in the instance version: link.

 

If you find  this helpful or correct please mark it.

 

Kind regards

FIKRI BENBRAHIM Mohamed Jawad

dvp
Mega Sage

Hey

Any update on this?

If one of the responses provided above resolve your question, please mark the response as correct answer, so future readers can find solution easily.