Join the #BuildWithBuildAgent Challenge! Get recognized, earn exclusive swag, and inspire the ServiceNow Community with what you can build using Build Agent.  Join the Challenge.

How to limit the tables displayed in table selector of a 'Document ID' field?

sambhogal
Kilo Contributor

Hi Folks,

We are trying to implement some functionality in which we require a Document iD field and we need to be able to do the things below:

Preference 1: Be able to limit/default the value of the 'Table name' field (Document ID field type)based on another field on the same table (named 'Type')

Preference 2: Be able to limit a predefined set of tables which appear in the 'Table name' field of the Document ID type field instead of showing all the tables

Any ideas/solution are appreciated! Thank you!!

5 REPLIES 5

bernyalvarado
Mega Sage

Hi,



Have you tried using the default value and the reference qualifier available on the dictionary of the field?



Thanks,


Berny


Hi Berny, its a Document ID type of field (different than a reference field). It does not have a reference qualifier (or I am not able to find it )


walterdg
Tera Contributor

Hi,



First, create a Script Include whose process() method returns an array of table names from which to select.



find_real_file.png


Second, add the attribute 'tableChoicesScript=testMIRelationship' to the definition of the field which the document id field is dependent to (use Advanced View)


find_real_file.png



Result:


find_real_file.png


B_10
Tera Contributor

This needs marked as the correct answer, to give this person some credit for a spot-on answer, since this solution could be used to dynamically decide the tables available for use by the document-id field, no matter what the use case.  Nice job, this was definitely a nuanced solution.  Thank you for sharing.