Can I add a record to sys_dictionary by using a script?

erantal2000
Giga Contributor

Hi everyone,

I am trying to create a script that will automatically add field to a table.

Is there a way I can do this? maybe by adding a record to sys_dictionary?

I tried to do that by using GlideRecord but it didn't work.

Any ideas?

1 ACCEPTED SOLUTION

I just created my own app and scoped table. WHen I executed it on scoped app, it gave me cross-scope-privilege error.

I executed it in Global scope and it worked.


Please mark this response as correct or helpful if it assisted you with your question.

View solution in original post

14 REPLIES 14

SanjivMeher
Kilo Patron
Kilo Patron

Can you share your script?


Please mark this response as correct or helpful if it assisted you with your question.

var r = new GlideRecord('sys_dictionary');
r.initialize();
r.active = 'true';
r.internal_type = 'string';
r.name = 'my_table_name';
r.column_label = 'Field 1';
r.element = 'field1';
r.max_length = 40;
r.table_reference = 'false';
r.insert();

 

Not working 😞

I used below script. it worked fine. I also added the sys_scope field and commented the active=true

 

var r = new GlideRecord('sys_dictionary');
r.initialize();
//r.active = 'true';
r.internal_type = 'string';
r.name = 'incident';
r.column_label = 'Field 1';
r.element = 'field1';
r.max_length = 40;
r.table_reference = 'false';
r.sys_scope='global';
r.insert();


Please mark this response as correct or helpful if it assisted you with your question.

Sorry, not working 😞

I need it in a specific scope so I tried to use the following line:

r.sys_scope = 'SYS_ID_OF_SCOPE';

And when it didn't work I tried your line referring to the global scope.

Both didn't work 😞

I read somewhere that there is a utility called GlideTableCreator, but I can't find any reference about it, so I can't try it. Maybe someone knows anything about it?