- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
â07-31-2020 07:57 AM
I have a requirement to hide an RITM from one catalog request for everyone unless they are the submitter. Additionally, task needs to be hidden to everyone except users in a particular assignment group or the submitter.
I was going down the ACL path, but since this is such a small use case, I'd rather use an on before query business rule. Any help appreciated!
Solved! Go to Solution.
- Labels:
-
Scripting and Coding
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
â07-31-2020 09:49 AM
In query BR you won't know the RITM's catalog item name using the current object
It will add generic query.
In the case of ACL you will have to create new one and update the existing ones so that they don't work for your catalog item.
But note they will be able to see other RITMs belonging to other catalog item as per your requirement.
Example:
1) New ACL
Condition: Catalog Item [IS] Your Catalog item && Request.Requested For [IS] Dynamic Me
2) Older ACLs update
Condition: Catalog Item [IS NOT] Your Catalog item
Regards
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
â07-31-2020 09:49 AM
In query BR you won't know the RITM's catalog item name using the current object
It will add generic query.
In the case of ACL you will have to create new one and update the existing ones so that they don't work for your catalog item.
But note they will be able to see other RITMs belonging to other catalog item as per your requirement.
Example:
1) New ACL
Condition: Catalog Item [IS] Your Catalog item && Request.Requested For [IS] Dynamic Me
2) Older ACLs update
Condition: Catalog Item [IS NOT] Your Catalog item
Regards
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
â03-16-2025 11:08 AM
Hey Ankur ! I have the same requirement and I tried to achieve through Before Query Business Rule .The access to requested item and task worked but It is effecting Approvals.Approvals are not getting created when users with not access to the item are submitting request

- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
â07-31-2020 11:11 AM
Was bit late but Glad you got it working.
As Ankur said getting Item name will not be possible for Business Query rule to work & if so will involve more efforts & thus suggested ACL approach.
Good to know you went for ACL approach & it worked. Welcome to the community.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
â10-20-2021 06:37 AM
@ Ankur Bawiskar,
Can you please help me with before query business rule,
Q: Assets owned by SRG must be hidden from users assigned to a command code outside of SRG.
*Update script to check for Command Code.Parent Command Code IS NOT srg (System Property created as part of this requirement)
Script:
(function executeRule(current, previous /*null when async*/ ) {
// Add your code here
if (current.u_command_code.u_parent_command_code != gs.getProperty('srg')) {
if (!gs.hasRole('srg' || 'admin') && gs.isInteractive()&& gs.getSession()) {
var uID = gs.getUserID();
var uGR = new GlideRecord('sys_user');
uGR.get(uID);
//var q = current.addEncodedQuery('department!=221f3db56112284009f4becd3039cc9');
var a = current.addEncodedQuery('u_command_code.u_parent_command_code!=bf47f29cdb701c10adc48c923996190f'+ gs.getUserName());
uGR.query();
gs.info('srg assets');
}
}
})(current, previous);
Please help me with this script ,
Thanks in Advance!
Any help is appreciated from others too!

- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
â11-03-2022 06:50 AM - edited â11-03-2022 06:55 AM
This requirement can be fixed with a before query business rule.
If this answer was helpful, I would appreciate if you marked it as such - thanks!
Best
Daniel