When using the API GlideTableCreator all columns longer than 30 characters get truncated.

markherring
Kilo Expert

When using the API GlideTableCreator all columns longer than 30 characters get truncated. We cannot use the UI to create these tables.

Anybody know of a solution to this?

2 REPLIES 2

Ct111
Tera Sage

Hello,

 

I hope you are using the below script for creating a table and a field inside it ,

so if you follow the below script then by default the field that is create in it 40 in size.

so if you want to increase the size then use setLength as shown below.

 


var table_name = 'adabab', extends_table = 'task', fname = 'testfield';

 

var attrs = new Packages.java.util.HashMap();
var ca = new GlideColumnAttributes(fname);
ca.setType("string");
ca.setLength('500');
ca.setUsePrefix(false);
attrs.put(fname, ca);

 

var tc = new GlideTableCreator(table_name , table_name);
tc.setColumnAttributes(attrs);

if(typeof extends_table != 'undefined') tc.setExtends(extends_table);
tc.update();

 

Mark my ANSWER as CORRECT and HELPFUL if it helps.

 

 

 

markherring
Kilo Expert

Unfortunately that sets the length of the field created (i.e. how many chars it can hold) not the length of the field name.  If the field name itself is more than 30 characters it gets truncated.