- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎02-25-2018 08:03 AM
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?
Solved! Go to Solution.
- Labels:
-
Integrations
-
Scripting and Coding
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎02-27-2018 09:20 AM
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.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎02-26-2018 07:28 AM
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎02-27-2018 12:32 AM
Still, not working 😞
var r = new GlideRecord('sys_dictionary');
r.initialize();
r.active = 'true';
r.internal_type = 'string';
r.name = 'x_77594_my_table';
r.column_label = 'Field 1';
r.element = 'field1';
r.max_length = 40;
r.table_reference = 'false';
r.sys_scope = 'x_77594_my_scope';
r.insert();
Record not created...
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎02-27-2018 07:34 AM
Are you running this script on the same Scope 'x_77594_my_scope'? That is Do you have the application set to scoped app and not Global.
Do you see an error in system log? DId you try running it from Background script
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎02-27-2018 08:09 AM
1. Yes, I am running it from the same scope 🙂
2. I am running it from an on demand scheduled job. I add gs.info in the beginning of the script and in the end of the script. I see the output of both gs.info scripts in the log, but other than that - nothing. No errors, no other logs. And the record is not created...
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎02-27-2018 08:34 AM
I removed few things. Can you give one more try.
var r = new GlideRecord('sys_dictionary');
r.initialize();
r.internal_type = 'string';
r.name = 'x_77594_my_table';
r.column_label = 'Field 1';
r.sys_scope = 'x_77594_my_scope';
r.insert();