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

Hi Mahira,



Now, 2 days later - it is still not possible to get any hits searching for 'abc'.


So I don't think the indexing time is the issue.



I also tried manually generating the text index from the dictionary - that didn't change the situation either.



Any other recommendations?


Hi Morten,


Unfortunately I donot know why the changed value doesn't come up in the search results.


I am curious to know the solution this problem as well.


I would recommend to open a hi ticket for resolution.


If you get an answer please do post it here.



Regards,


Mahira


Mahira - I got a solution from HI - take a look...


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.