- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎11-07-2019 11:28 AM
Hi there,
I'm working on a custom table with a choice field that gets its options dynamically filled by a Client Script that way:
g_form.addOption('<field>', <name of a table>, <label the table>);
When I open the dropdown, I see the labels as expected. But when I save the form, I suddenly see the name instead.
Example: I select "Story", but after saving, I see "rm_story".
Does anyone have an idea what I may be doing wrong?
Best regards,
Kosh
Solved! Go to Solution.

- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎11-08-2019 07:15 AM
I was referring to the fact there is a Table Name field type that you can use for the field. You can then look at using an INSTACEOFtask filter to get just tables that are child of task.

- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎11-07-2019 11:50 PM
Great. Do let me know if you are stuck at anything.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎11-08-2019 02:24 AM
Thanks to your great article, I came further, and I think I'm close to a solution. I am sure I'm just missing a very small detail to get it running as expected. I decided for the Script Include + Advanced reference qualifier, which was actually the solution that I tried in the very beginning of this journey.
However, I got stuck again in the same place where I was last time: I think I did everything as described, but nothing happens when I do the lookup.
This is my Script Include:
var u_getAssignmentTables = Class.create();
u_getAssignmentTables.prototype = Object.extendsObject(global.AbstractAjaxProcessor, {
initialize: function() {},
getAssignmentTables: function() {
var grTaskTableObject = new GlideRecord('sys_db_object');
grTaskTableObject.get('name', 'task');
var taskTableSysId = grTaskTableObject.sys_id;
var tables = [];
var grTableObject = new GlideRecord('sys_db_object');
grTableObject.addActiveQuery();
grTableObject.addEncodedQuery('super_class=' + taskTableSysId + '^ORname=rm_story');
grTableObject.query();
while (grTableObject.next()) {
tables.push(grTableObject.getValue());
}
return 'sys_idIN' + tables;
},
type: 'u_getAssignmentTables'
});
And this is how I call it in the Reference qual field:
javascript:new u_getAssignmentTables().getAssignmentTables();
However, I just see "-- None --" when I open the dropdown.
Is it because I'm working in a scoped app?

- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎11-08-2019 03:00 AM
Replace this line
tables.push(grTableObject.getValue());
WITH
tables.push(grTableObject.getValue("sys_id"));
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎11-08-2019 04:53 AM
Ouch, that's awkward. Thanks a lot. Now it works as expected, and I can reduce the complexity of my app a lot.
You made my day. 🙂

- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎11-08-2019 04:56 AM
Great. Have a good weekend 🙂