- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎07-11-2022 01:05 AM
I have a doubt that in my sys_db_object table when i go to incident table and see the fields there are around 100 fields for the table.But in sys_dictionary if i search for incident table there are only 25 fields so why do sys_dictionary does not contain all the fields of the particular table ...If not how can i see all fields in sys_dictionary table as we want to use that table to view fields in our ui page slushbucket
Solved! Go to Solution.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎07-11-2022 05:30 AM
Below is the complete solution
Use reference qualifier as javascript: 'sys_idIN' + new ScriptInclude().returnFields(tableName);
Use the below script include
returnFields : function(tableName){
var fieldArray = [];
var extendsTable = "nothing";
fieldArray.push(getRecords(tableName));
var extendsTable = getParentTable(tableName);
while (extendsTable != "none"){
fieldArray.push(getRecords(extendsTable));
extendsTable = getParentTable(extendsTable );
}
return fieldArray;
},
getRecords: function (tableName){
var dictfields = new GlideRecord('sys_dictionary');
dictfields.addQuery('name',tableName);
dictfields.query();
while(dictfields.next())
{
var obj={};
var wel=dictfields.getDisplayValue('column_name');
var text=dictfields.getDisplayValue('column_label') ;
obj.value = wel;
obj.text=text;
arr_dict_fields.push(obj);
return arr_dict_fields;
},
getParentTable: function(tableName){
var dbObject = new GlideRecord('sys_db_object');
dbObject.addQuery('name',tableName);
dbObject.addEncodedQuery('super_classISNOTEMPTY');
dbObject.query();
if (dbObject.next()){
return dbObject.super_class.name.toString();
}
else{
return "none";
},
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎07-11-2022 02:36 AM

- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎07-11-2022 02:47 AM
In sys_db_object table, you also get fields from Task table.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎07-11-2022 03:06 AM
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎07-11-2022 03:27 AM
Hello,
I think as mervin said in the above answer sys_dictionary table is for showing fields on that table and sys_db_object table shows the fields which were inherited from task table.
So incident is extending task table so you were able to see more fields in sys_db_object
Ideally the solution for your question would be as you said you have a UI page slush bucket make the reference to sys_db_object table instead of sys_dictionary and before pushing the fields into slush bucket you need to query sys_db_object table and find the fields which are there in your required table and also through script check the task table fields as incident is extending task table and pick up the fields on the task table too and push it into the slush bucket.
I can think only this as a solution
Please mark my answer correct if it helps you in giving an idea how to achieve this
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎07-11-2022 03:36 AM
var dictfields = new GlideRecord('sys_dictionary');
dictfields.addQuery('name',tableName);
dictfields.addEncodedQuery(strQuery);
dictfields.query();
while(dictfields.next())
{
var obj={};
var wel=dictfields.getDisplayValue('element');
var text=dictfields.getDisplayValue('column_label') ;
obj.value = wel;
obj.text=text;
arr_dict_fields.push(obj);
}