filter condition on reference field
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎08-12-2020 11:29 PM
Hi All,
I need to display values in 'requested for' field on ritm table based on some conditions.
My instance setup:
1. I am working on a domain separated instance.
2. 3 domains are there (d1,d2,d3)
3. I am an itil user in domain d1 but i have visibility in d2 because of some roles. So i can see the ritms for d2 as well.
4. Currently requested for is displaying users for d2 because of following script:
reference qualifier on requested for:
javascript:new GetRequestors().getrequestorsRITM(current)
script in script include called above:
query = 'active=true^sys_domain='+current.sys_domain;
return query.toString();
My requirement:
i need to display users from d1 domain as well but the lookup should not display values together onclicking the lookup option of ref field.
That is, d1 users should only be visible when user gives filter..
is this feasible? Can this be achieved?
- Labels:
-
Script Debugger
-
Scripting and Coding
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎08-13-2020 01:24 AM
Hi, perhaps an underpinning refqualifier that returns all the required data from both domains, and then a default list filter set to show results where Company IS D2. You can then change this default filter to Company IS DI on the fly, or remove it to see all results from the refqual.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎08-13-2020 03:26 AM
Hi Tony,
Thanks for the response!
Can you please elaborate on what does underpinning a reference qualifier mean?
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎08-13-2020 01:28 PM
Hi, the reference qualifier you applied to the list would need to return all possible record results, then you would set a default filter to show only a subset of the refquals data.
IE refqual returns records for D1 and D2, the default list filter then shows only D2 results, but you can manaully change the filter to show D1 results or both D1 and D2 results. Regardless of changes to the default filter users will never see data that was not returned by the original (underpinning) reference qualifier (D1 and D2).
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎08-16-2020 09:59 PM
Hi Tony,
Thanks for the clarification.
But it seems if i define both default filter and reference qualifier, the script calling from ref qualifier (which is returning all the values) is overriding the values returning from default filter(which is returning subset of values).
i have written following scripts.
1. Script include being called from ref qualifier:
var user = new GlideRecord('sys_user');
user.get(gs.getUserID());
var query = '';
query = 'active=true^sys_domain=' + current.sys_domain + '^ORsys_domain=' + user.sys_domain;
return query.toString();
2. Dynamic default filter:
This doesnot seem to work at all.