Comments on: Controlling record access using ‘Before Query’ business rules https://servicenowguru.com/business-rules-scripting/controlling-record-access-before-query-business-rules/ ServiceNow Consulting Scripting Administration Development Wed, 06 Mar 2024 20:27:09 +0000 hourly 1 https://wordpress.org/?v=6.8.2 By: Jim Basa https://servicenowguru.com/business-rules-scripting/controlling-record-access-before-query-business-rules/#comment-6414 Wed, 26 Sep 2018 21:11:09 +0000 https://servicenowguru.wpengine.com/?p=514#comment-6414 Thanks so much for this! I am coming to express and learning new things about the platform and your site is very helpful, even for me who is very green with scripting.
This worked perfectly!

]]>
By: Davin https://servicenowguru.com/business-rules-scripting/controlling-record-access-before-query-business-rules/#comment-6413 Thu, 21 Apr 2016 02:52:46 +0000 https://servicenowguru.wpengine.com/?p=514#comment-6413 Hi,
we’ve noticed that the Before Query shows up in Global Text Searches.

Normally this is probably OK, but one of our Query Rules returns a very long encoded query, which then displays over more than 10 lines before the actual results are shown.

I’ve hidden the Filter using jQuery in a Global UI Script, eg $j(‘span.searchfilterdisplay’).hide(); but hoping there is a better way!

Cheers,
Dav

]]>
By: Mark Stanger https://servicenowguru.com/business-rules-scripting/controlling-record-access-before-query-business-rules/#comment-6412 Thu, 28 Jan 2016 14:09:18 +0000 https://servicenowguru.wpengine.com/?p=514#comment-6412 In reply to Rafael Mercês.

I don’t know of anything I have in this article that would impact request items at all. Depending on how you’ve implemented it, I suppose there’s a possibility that a query business rule could cause an issue but that’s probably a general ServiceNow question rather than something related to my explanations in this article. I’d contact SN support or the SN community for help on this.

]]>
By: Rafael Mercês https://servicenowguru.com/business-rules-scripting/controlling-record-access-before-query-business-rules/#comment-6411 Thu, 28 Jan 2016 13:02:40 +0000 https://servicenowguru.wpengine.com/?p=514#comment-6411 Hi Mark,

We implemented your solution and it affected 1 of our catalog itens in the following way: when requesting the item, on submit, the item is generated (REQ and RITM), but the RITM is generated without workflow associated to it. Have you ever seen this kind of scenario?

Thanks,

]]>
By: Mark Stanger https://servicenowguru.com/business-rules-scripting/controlling-record-access-before-query-business-rules/#comment-6410 Thu, 08 Jan 2015 18:54:18 +0000 https://servicenowguru.wpengine.com/?p=514#comment-6410 In reply to Shane.

Shane, thanks for reading and for your comment! The examples above should show a couple of ways to add the ‘or’ condition. Honestly, these are usually pretty tricky for me as well. Sometimes I just eliminate the confusion completely by creating a filter in a standard list to show the records I want to show, then right-click the portion of the list breadcrumb to copy the query. Once you’ve done that, you can easily use ‘addEncodedQuery’ to add the exact same query that appears in the list. Check out this guru article for details on ‘addEncodedQuery’.

https://servicenowguru.com/scripting/gliderecord-query-cheat-sheet/

]]>
By: Shane https://servicenowguru.com/business-rules-scripting/controlling-record-access-before-query-business-rules/#comment-6409 Thu, 08 Jan 2015 17:40:03 +0000 https://servicenowguru.wpengine.com/?p=514#comment-6409 Hi Mark,

I am trying to use a business rule to limit the HR Cases (hr_case table) which show via the Open module based on the logged in user’s assignment group AND based on 2 categories.

In short, if the logged in user is in the “Money” group, then they should only see cases where the Category is Benefits OR Payroll. The OR condition is causing me issues!

Thank you for your posts. They are always very helpful!

]]>
By: Mark Stanger https://servicenowguru.com/business-rules-scripting/controlling-record-access-before-query-business-rules/#comment-6408 Fri, 12 Sep 2014 12:12:57 +0000 https://servicenowguru.wpengine.com/?p=514#comment-6408 In reply to Namrata Jain.

This isn’t tied to a particular UI component at all, since it’s tied to the actual database query it should work anywhere in the system.

]]>
By: Namrata Jain https://servicenowguru.com/business-rules-scripting/controlling-record-access-before-query-business-rules/#comment-6407 Fri, 12 Sep 2014 09:59:28 +0000 https://servicenowguru.wpengine.com/?p=514#comment-6407 Hi,

Have you ever tried this on glide list field, the field above is reference field and hence it is doable, but what if the field is glidelist, is it doable or not?

Best Regards,
Namrata Jain

]]>
By: Mark Stanger https://servicenowguru.com/business-rules-scripting/controlling-record-access-before-query-business-rules/#comment-6406 Wed, 18 Jun 2014 11:57:33 +0000 https://servicenowguru.wpengine.com/?p=514#comment-6406 In reply to Elizabeth.

That is possible, and may be a very good use for this type of functionality.

]]>
By: Elizabeth https://servicenowguru.com/business-rules-scripting/controlling-record-access-before-query-business-rules/#comment-6405 Wed, 18 Jun 2014 07:51:15 +0000 https://servicenowguru.wpengine.com/?p=514#comment-6405 Hi Mark – is it possible to use this function to restrict access to specific Standard Changes? For example if we have a standard change for changing the firewall it would not be prudent to allow anyone to choose this standard change – how would we go about locking the change for anyone other than a specific group or groups so it doesnt appear in the drop down list of changes for that specific Program Element?

]]>