Reference Qualifier
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
01-16-2025 07:27 PM
Hi All,
User environment is domain-separated. The user wants to filter the result for locations based on the company selected in a custom table. This custom table contains both location (referencing to cmn_location) and company (referencing to core_company) fields. Currently, when user clicks on the location field, the list displays all available locations, but the user wants that the list should only show locations related to the company specified in the current record. Additionally, the user should have the ability to modify the filter if needed.
Current reference qualifier is as below:
javascript: 'sys_domain='+current.sys_domain.toString();
How can I modify this to get the above requirement ?
Regards,
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
01-17-2025 02:02 AM
If the company is specified in the current record via a field, then your qualifier would look like this:
javascript: 'sys_domain='+current.sys_domain.toString()+'^company='+current.company;
The first appearance of 'company' is the field name on the reference table. current.company is the field on the form/table the list should be filtered by, so change these according to your environment. Users cannot modify reference qualifiers - only by selecting a different company in this case.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
01-19-2025 04:37 PM - edited 01-19-2025 04:46 PM
Hi Brad, there is one additional part to the requirement.
1. User should be able to modify the filter so that they can choose any location they want independent of the company. (is this possible in any other way)
2. there is one more reference field on the custom table and the location should be filtered based on company or this second field.
In Summary, The system should filter the location lists based on the selected company and second field value but also should allow the user to override it manually. How can we achieve this?
Rehards,
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
01-20-2025 04:48 AM
The only solution that comes to mind is to have another field like a radio button or choice where the user can select to filter by 'Company', or 'All'. You would change the reference qualifier to something more like this:
javascript:var ret='sys_domain='+current.sys_domain.toString();if(current.new_choice_field == 'filter_company') ret +='^company='+current.company;ret
where 'new_choice_field' is the name of the new field, and 'filter_company' is the value of the limiting choice.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
01-17-2025 02:08 AM
you can combine the reference qualifier as per what Brad shared
Do check that and share us the updates.
If my response helped please mark it correct and close the thread so that it benefits future readers.
Ankur
✨ Certified Technical Architect || ✨ 9x ServiceNow MVP || ✨ ServiceNow Community Leader