Can a before query business rule be used on a reference field result set instead of a reference qualifier?
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
10-27-2019 05:25 PM
Is there a way to user a before query business rule on a reference field to limit the result set of the reference field based on the table that contains the reference field? Typically, this would be done via a reference qualifier, but in a domain separated environment, the use of reference qualifiers is restricted because they are not domain aware. A ref qualifier will operate the same way regardless of which domain it is being invoked from. A business rule is domain aware, however, so it would be ideal if before query business rules could be used to limit the result set of the ref field. An example: if I wanted to limit the assignment group result set from the change_request form only for only one domain, could this be done with a reference qualifier?
- Labels:
-
Scripting and Coding
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
10-27-2019 09:50 PM
Hi Kristian,
you can use reference qualifier for this I believe since group table has domain field
Based on current logged in user's domain you can get the groups belonging to those domains.
query business rule is used to restrict the records in a table based on specific condition
Mark ✅ Correct if this solves your issue and also mark 👍 Helpful if you find my response worthy based on the impact.
Thanks
Ankur
Ankur
✨ Certified Technical Architect || ✨ 9x ServiceNow MVP || ✨ ServiceNow Community Leader
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
10-27-2019 10:07 PM
Thanks for responding. The current logged in users are always only going to see the groups that are part of their domain. My scenario was more of, say users of one domain want to filter their assignment groups so that they only see groups of type 'itil", whereas another domain has users that want to filter based on the name not including the word "Security", for instance. So I'm speaking more of a situation where users of two different domains need two drastically different reference qualifiers on the same field. So I could easily create a before query business rule that says show itil groups on the sys_user_group table for domain A, and then another business rule that shows non-security groups for domain B. Users of each domain will only see the filtered lists. But what if I only want that filter to apply to the result set returned when being queried from a reference field in a different table? That's the question.
And sure I could create a script include that is domain aware that can return a domain-aware reference qualifier, but then I have to write that so it applies to all of the domains in the system and would pretty much have to hard-code domain switches within the script include. It would be a maintenance problem