How to filter a dictionary entry table based on the table selected

menakasuri
Kilo Contributor

Hi,

We have a requirement to create two new fields on a customized table. One field is of type TableName and another field is of type Slush Bucket. So, based on the table selected from the first field, the second field(slush bucket) should get all the columns available from the table selected. We are not able to create a field of type slush bucket, therefore using List type. Now the list field is referencing the Dictionary Entry table. I want to filter the columns available in the dictionary entry table based on the table selected. How do i achieve this? Please need a help on this..

Thanks in advance

7 REPLIES 7

reginabautista
Kilo Sage

Hi Menaka,



I think there is not slush bucket option on the form. You could however create a 'List' field for this use case then under Reference select Table to get all the table names (or point to your own table if you have one)


find_real_file.png



Then on the onChange of the field, you can then loop through the values of the list field and use getFields to get all the column names.



Read item 9.9 in article below:



http://wiki.servicenow.com/index.php?title=GlideRecord#getFields


amlanpal
Kilo Sage

Hi Maneka,



Please go to the List type field dictionary. Under 'Reference qualification' tab please select 'Use reference qualifier' as 'Advanced' and in the 'Reference equal' field write the below one:


javascript: "nameIN"+current.table_field_name.getDisplayValue();



Please have a look at this thread: Filter CIs based on the



I hope this helps.Please mark correct/helpful based on impact


Hi Amlan,



Thanks for the reference qualifier script. The script works!! But there is another requirement.


Suppose, if i select Incident table, the script filters the columns that belong only to Incident table and only those columns are made available on the field. We know that the Incident extends Task table, and there are many fields which are coming from Task to Incident table(Ex: Say short description, active etc). So, our requirement is, we have to filter the columns that are available on the Incident form, that includes columns from Task table too. Could you please help me on this?



Thanks in advance.


Hi Maneka,



I'm Glad it helped you!


Well in this case it is not possible. Cause one Column (or you may read field) can be available against a single table at a time. And as you are fetching the columns against the Table, you can only get the corresponding Columns. If you are interested in another table's column (in your case it is Task), you have to choose Task table in the table field. Hope this clears your idea a bit.


Also please mark the Answer correct and close the thread so that it can be tracked later by others in need.



I hope this helps.Please mark correct/helpful based on impact