- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎04-19-2021 07:31 AM
Is is possible to apply filter to a reference field that has a m2m table?
For example:
Locations (cmn_location) has m2m relationship with groups. When adding location to incident form, is possible to filter out only locations that have a specific group?
Thanks,
Valter
Solved! Go to Solution.

- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎04-20-2021 08:00 AM
This is what the docs say
*****
Note: Related list queries must be enabled in System PropertiesList v3. Select the Allow related list query conditions to be added through the filter check box to enable it.
You can build a related list query for a list that uses List v2, however, the filter conditions cannot be modified until you removed the related list condition in the breadcrumb.
*****
So it can be used there is just no way to edit the query using the list until that part is removed.
Make sure you have the SNUtils installed in Chrome or Firefox. Then go to Reporting and build the query you need using what ever filter. Once done you can then just double click on some white space at the end of the filter breadcrumb and it will give you a popup that has the query you need to use.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎04-19-2021 07:53 AM
That looks like a dictionary form, are you creating a field?
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎04-19-2021 07:57 AM
This is the location field on the incident form. I want to filter out to only show specific location that have the m2m relationship. What would the reference qual would look like. I am not able to do simple reference qualifier.

- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎04-19-2021 07:48 AM
So you have a location field on the incident form and it is a reference that points to the location table. You want to filter the selections in the location field to only show those locations that are for Group X. Is Group X static? Or is Group X from another field on the form?
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎04-19-2021 07:52 AM
It will probably be both static/another field depends on the form. But for this form, it will be static.

- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎04-19-2021 08:24 AM
Then your reference qualifier for the location field with a static group will look something like
^RLQUERY<RELATED_TABLE>.<LOCATION_FIELD_ON_RELATED_TABLE>,>=1^name=<NAME_OF_GROUP>^ENDRLQUERY
//So for the cmdb_ci_group table to filter the locations you would use the below.
^RLQUERYcmdb_ci_group.location,>=1^name=Test Group^ENDRLQUERY
For something that is dynamic you should be able to make the location field dependent on what ever group field you use provided the group field DB name ends with "_group".