filter m2m related list

El Cuchi
Tera Guru

Hi all,

 

i hope u r all ok at your end.

i created a related list in the knowledge article so i can show business applications related to each KA.

i created the relationship as follows.

name "XXXXXX"

applies table:  cmdb_ci_business_app

queries from table:  m2m_kb_ci

query:  current.addQuery('u_kb_cis', parent.sys_id);

 

This works in the sense that when i create a KA and go to the related list i can click on EDIT button so a popup is displayed for me to select any business application.

 

ISSUE

the popup does not have any filter and it appears to me that brings all classes, not just business applications and CIs where name is empty. (Image)

ElCuchi_0-1708643877920.png

 

 

how could i remove the CIs with empty names?

 

1 ACCEPTED SOLUTION

Mio Matsushita
Mega Sage

Hello.
You can create a m2m relationship between a new Knowledge article and a business application.
Please create a record like the one in the image in the Many to Many Definition [sys_m2m] table.

image1.png
You will be able to select Business Application in the related list of Knowledge Articles.

image2.png

 

Another solution is to set the default filter when pressing the [Edit...] button in m2m_kb_ci without creating a new m2m relationship.
The following KB is a good reference.
https://support.servicenow.com/kb?id=kb_article_view&sysparm_article=KB0720545

image3.png

View solution in original post

1 REPLY 1

Mio Matsushita
Mega Sage

Hello.
You can create a m2m relationship between a new Knowledge article and a business application.
Please create a record like the one in the image in the Many to Many Definition [sys_m2m] table.

image1.png
You will be able to select Business Application in the related list of Knowledge Articles.

image2.png

 

Another solution is to set the default filter when pressing the [Edit...] button in m2m_kb_ci without creating a new m2m relationship.
The following KB is a good reference.
https://support.servicenow.com/kb?id=kb_article_view&sysparm_article=KB0720545

image3.png