Search on Two Columns with Reference Field Variable

Shivam Saxena1
Mega Expert

Hi,

 

There is a reference field named as 'Asset' in my change form.

 

find_real_file.png

 

When we click on search icon we have below columns.

 

find_real_file.png

 

Right now we can able to search based on column 'Name'.

I want a user can able to search the asset directly by typing in refence field using column 'Name' - name and 'Asset Tag' - asset_tag. When he give name then also it will show the result and if the user give asset tag then also he can able to search.

 

Right now I am getting below error when I am trying to search using asset tag.

 

find_real_file.png

 

Below is the field dictionary :

 

find_real_file.png

find_real_file.png

 

What script I need to write and where? Please help?

 

Thanks.

1 ACCEPTED SOLUTION

Hi,

then using this it should work

ref_auto_completer=AJAXTableCompleter,ref_ac_columns=name;asset_tag,ref_ac_columns_search=true

Are you checking with admin or non-admins

Regards
Ankur

Regards,
Ankur
Certified Technical Architect  ||  9x ServiceNow MVP  ||  ServiceNow Community Leader

View solution in original post

25 REPLIES 25

asifnoor
Kilo Patron

Hi,

Try like this and it will work.

ref_auto_completer=AJAXTableCompleter,ref_ac_columns=display_name;asset_tag,ref_ac_columns_search=true

Mark the comment as a correct answer and also helpful once worked.

 

Hi Asif,

 

Column name is 'name'.

 

find_real_file.png

 

Not sure why it is not working.

@Shivam Saxena 

It should work fine provided that name/record satisfied your reference qualifier condition

Below worked for searching on name

find_real_file.png

Below worked for searching on asset tag

find_real_file.png

Regards
Ankur

Regards,
Ankur
Certified Technical Architect  ||  9x ServiceNow MVP  ||  ServiceNow Community Leader

Okay.

1. Can you go to hardware.list and take any 1 name and search here and show me what you get?

2. Even in hardware table, the column name is display_name. 

Since there is additional filters check if the given name is meeting those ref qual filters or not as well.

Kindly mark the comment as a correct answer and also helpful once worked.

Hi Asif,

 

This is the field.

 

find_real_file.png

 

When you click on search then it will show below table.

 

find_real_file.png

 

This table is cmdb_ci_hardware.

 

Now, if I select any value in reference and open info

 

find_real_file.png

it opens below table

 

find_real_file.png

 

My dictionary :

 

find_real_file.png

 

find_real_file.png

 

Now please let me know where I am going wrong?

 

Thanks.