How to add caller.user_name to global text search

Morten Steenbac
Giga Expert

I would like to be able to write a User ID in global text search, and see all incidents where the user id is 'caller' or 'assigned_to'.

How to achieve that?

I tried adding the attribute: ref_auto_completer=AJAXTableCompleter,ref_ac_columns=user_name,ref_ac_columns_search=true,ref_ac_display_value=false

...on caller_id - as described here: Re: Using the User_Name (user id field) as the search qualifer on Incident Management. , but it didn't seem to work.

1 ACCEPTED SOLUTION

Morten Steenbac
Giga Expert

The following solution was proposed by HI support:



The solution you need will be to add data into an indexed column on Incident that includes the user ID. You have two fields you want to search for a user ID - Caller and Assigned To - so I suggest generating two new columns, which store the user ID for the respective field. These columns will need to be populated from the Caller and Assigned To fields, to do a lookup based on the user name to extract the user ID. You may need to use a Client Script to apply this on new records, and another script will also be needed to populate existing records. By then adding a text index to these two new columns - lets calls them u_caller_userid and u_assigned_to_userid - then you will be able to use these in a global text search. Once these user IDs are found in the search, the index will be returned.



https://docs.servicenow.com/bundle/helsinki-servicenow-platform/page/administer/search-administratio...



You probably won't want these new fields appearing on the form, but you will need to add them to the form so that the Client Script can update them on saving of a record. However, you can hide them using a UI Policy.


As you can see, there is not really an OOTB method for what you need, but you can use existing functionality to extend the capabilities of the application.


View solution in original post

13 REPLIES 13

Mahira
Tera Guru

Hi Morte,



Are you referring to Global Text Search?



Regards,


Mahira


Yes!


amlanpal
Kilo Sage

Hi Morte,



Please navigate to System definition--> Search Group-->Tasks. You can find few records under Text Search Tables over there. You can either add new one or modify the existing incident one with the condition which you want.



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



Under the Incident text search group, I can add sys_user as an entry.


But that is just showing records from the sys_user tabel under the 'Incident' search group.



If I want to show incidents where Caller og Assigned To equals the user id entered - how do I achieve that?