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.

Reference data present in multiple tables

ShAn21
Tera Guru

HI Folks,

I have a requirement where the data for a reference field are present in multiple tables. 3 to be precise

Yes, it does not have a same parent nor a new custom table to hold the data can be used.

Do we have any viable best option for this.

I can thing of only 2 options.

1) Have 3 different fields for each table and guide the user to search in each field.

2) Check for document_id field. But I feel this is not really a customer friendly field. Please let me know if you feel otherwise.

Any suggestions/feedback is appreciated.

Thanks in advance.

1 ACCEPTED SOLUTION

Arav
Tera Guru

Hi @ShAn2 ,

Do you know why there are 3 separate tables to store this data ? Is there a way these could be consolidated into 1 ?

A reference field can point to only 1 table. If the data to be displayed in a reference field is dependent on other tables, then that could be achieved by writing a script include function, which can be called from the field's reference qualifier.

But in this instance, if the data has to be retrieved from 3 separate tables, then 3 different fields is probably the way to go. As needed, you may want to consider writing a client script that runs when data is picked in 1 field to hide the other two.

Thanks,

Arav

 

View solution in original post

1 REPLY 1

Arav
Tera Guru

Hi @ShAn2 ,

Do you know why there are 3 separate tables to store this data ? Is there a way these could be consolidated into 1 ?

A reference field can point to only 1 table. If the data to be displayed in a reference field is dependent on other tables, then that could be achieved by writing a script include function, which can be called from the field's reference qualifier.

But in this instance, if the data has to be retrieved from 3 separate tables, then 3 different fields is probably the way to go. As needed, you may want to consider writing a client script that runs when data is picked in 1 field to hide the other two.

Thanks,

Arav