Dynamic keyword search for custom table

Y_O
Mega Expert

Hi,

I'd like to achieve the following, but I don't know how to do it.

Perform a keyword search dynamically for the contents of the message field of the custom table [u_msg_list] from the information in the Description field of the incident record.

  e.g.
  The description field of the incident record has the following description text:
     XXXXXXXXXX CPU XXXXXXXXXXXXXXXXX

  The custom table record contains the following text in the message field:
    record A: XXXXX CPU XXXXXXX
    record B: XXXXX Memory XXXXXXX
    record C: XXXXX Disk XXXXXXX

  I'd like to display only record A from these.

I've now been able to display the custom table's records on the Incident Records page with System Definition> Relationships, but I don't know how to filter by dynamic keywords as described above.

For your information, Related Search function does not support custom tables.

Can anyone tell me how to set this up?

I'm new to ServiceNow and have no knowledge of scripts.
So I ask for easy-to-understand explanations (preferably with screenshots).

Thanks,

1 ACCEPTED SOLUTION

Y_O
Mega Expert

My team was able to do this.

I hope this information helps someone.

 

1. Enable text indexing for the custom table [u_msg_list]

https://docs.servicenow.com/ja-JP/bundle/quebec-platform-administration/page/administer/search-administration/task/t_EnableATextSearchOnATable.html

 

2. Register the following script with "Query with" of Relationships

   (function refineQuery(current, parent) {

   // Add your code here, such as current.addQuery(field, value);
   current.addQuery('u_active_inactive','true');
   current.addQuery('IR_AND_OR_QUERY',parent.description);

   })(current, parent);

View solution in original post

1 REPLY 1

Y_O
Mega Expert

My team was able to do this.

I hope this information helps someone.

 

1. Enable text indexing for the custom table [u_msg_list]

https://docs.servicenow.com/ja-JP/bundle/quebec-platform-administration/page/administer/search-administration/task/t_EnableATextSearchOnATable.html

 

2. Register the following script with "Query with" of Relationships

   (function refineQuery(current, parent) {

   // Add your code here, such as current.addQuery(field, value);
   current.addQuery('u_active_inactive','true');
   current.addQuery('IR_AND_OR_QUERY',parent.description);

   })(current, parent);