Reference Qualifier for a related list

John Prahn
Kilo Contributor

Hello, 

I am trying to use a reference qualifier on a related list. The related list is pointing to a custom table, joined together by many-to-many table. I am trying to limit the results on the related list by ensuring that we have the same company on our profile. I have tried using the information in this article: 

https://community.servicenow.com/community?id=community_question&sys_id=76200761db98dbc01dcaf3231f9619f4

However I have not been successful. The biggest question is which field on the custom table do I add the attribute. 

Any help is appreciated. Also if there is another way, I will look into that too. 

 

Thank you

1 ACCEPTED SOLUTION

Ahh I see. My apologies. You'll need to add one more line of code under the vendor query that looks like this:

 

current.addQuery('m2m.m2m_table.m2m_field', parent.sys_id);

 

except replace m2m_table with your m2m definition's many to many table, and replace m2m_field with your m2m definition's to field (which I'm assuming would be configuration_item)

 

Do you have access to your m2m definition? Type sys_m2m.list in the filter navigator to get a list of your definitions.

View solution in original post

9 REPLIES 9

If it's currently setup properly, let me know which changes to make to the list configuration. 

Thank you. This is helpful, but I found out that it is not impacting the related list from the m2m table, but it gave me a different related list. 

Hi John, 

Could you expand on this? Is the related list not filtering by the company? If so, could you send me a screenshot of your final relationship configuration, and the related list?

Hi Kerry, 

The first related list that you see is the one created from the M2M relationship. The second related list (addition_m) is from the relationship that was created using the code. 

The different between the two is that on the first related list I am able to add any record to the CI. While the second related list (even though it is giving me every record with the same company) it will not allow me to specify which one to add or take off. 

 

Ahh I see. My apologies. You'll need to add one more line of code under the vendor query that looks like this:

 

current.addQuery('m2m.m2m_table.m2m_field', parent.sys_id);

 

except replace m2m_table with your m2m definition's many to many table, and replace m2m_field with your m2m definition's to field (which I'm assuming would be configuration_item)

 

Do you have access to your m2m definition? Type sys_m2m.list in the filter navigator to get a list of your definitions.