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.

Agent Assist Dynamic Filtering Conditions

MattDever
Tera Contributor

Greetings fellow developers.  👋

 

After reading through a number of SNOW Product Docs (e.g., Set up a dynamic filter for Agent assist  Set up Agent Assist) as well as a post from a Daniel R2 (How to add a dynamic filter on agent assist to display knowledge articles from specific categories), I realized that there were no online resources that matched my use case requirements.

In a nutshell:

  • Filter Agent Assist knowledge articles only applicable to Service Desk Agents' job responsibility
  • List of applicable Knowledge Bases were provided that support our Service Desk Agents
  • List of applicable groups that align with the Service Desk team provided
  • Incident, Problem, Change, Interaction short description key words match on respective filtered knowledge article's Article Body

Using the "Script" option under the "Filter Configuration" of the existing out-of-the-box "Contextual Search" -> "Table Configuration" ("Agent Assist [kb_knowledge]") in comparison with what I found online, this is what I produced (where gs.property "service_desk_agent_assist" contains a list of Knowledge Bases' sys_ids):

(function(current, query_table){
	/**
	 * current: A GlideRecord representing the Form or Record producer
	 * query_table: The table to compare value on
	 *
	 * Use the standard query features of GlideRecord to add conditions to query_table.
	 * Current prepresents the current values on the user's form or record producer that
	 * can be used to add live conditions to the query.
	 *
	 * E.g. query_table.addQuery("active", current.active);
	 *
	 * The return value should always be the encoded query, usually query_table.getEncodeQuery()
	 */
	var sysIDs = gs.getProperty('service_desk_agent_assist');
	query_table.addActiveQuery();
	query_table.addQuery('kb_knowledge_base.sys_id', 'IN', sysIDs);
	query_table.addQuery('short_description', 'LIKE', current.short_description);


	// Return the encoded query
	return query_table.getEncodedQuery();

})(current, query_table);

  

MattDever_0-1751460423096.png

 

The result:

MattDever_1-1751460611756.png

 

May someone in this community be able to assist in coming up with a solution to this real-life use case requirement?

 

Thank you, in advance, to any and all who can help.

-  Matt

1 REPLY 1

eromlige
Tera Contributor

Did you find a solution for this one? I'd like to know too.