When using the API GlideTableCreator all columns longer than 30 characters get truncated.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎04-10-2020 02:00 AM
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?
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎04-10-2020 04:29 AM
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.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎04-10-2020 07:48 AM
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.