- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎04-10-2017 03:24 AM
Hi All,
I am retrieving the total (active & inactive) record count over a record producer form through Client script and script include which is working fine.
But, there is a OOB BEFORE - QUERY business rule which is running on User [sys_user] table which restricting the non admin users to get the inactive record count.
So, as per my requirement, I am thinking to modify it to allow the non admin role.
I would like to know that, is there any alternative way to overcome this instead of modifying the OOB business rule ?
Solved! Go to Solution.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎05-10-2017 02:48 AM
Hi All,
For others benefit, without modifying the OOB business rule, I have achieved this as mentioned below,
Bypassing the BR:
As I am querying (not insert/update/delete), I have used 'setWorkflow(false)' while querying the User table in script include to bypass business rules with a condition check "if current user contains the non-admin role" otherwise it runs as usual.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎04-10-2017 05:46 AM
Hi Vijay,
Since the onQuery business rule will run based on the condition and it will restrict the rowCount based on what query has been applied. As per my knowledge the only way to do this is to modify the onQuery business rule condition and then test the functionality thoroughly.
Mark Correct if this solves your issue and also hit Like and 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
‎05-10-2017 02:48 AM
Hi All,
For others benefit, without modifying the OOB business rule, I have achieved this as mentioned below,
Bypassing the BR:
As I am querying (not insert/update/delete), I have used 'setWorkflow(false)' while querying the User table in script include to bypass business rules with a condition check "if current user contains the non-admin role" otherwise it runs as usual.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎05-10-2017 03:37 AM
Hi Vijay,
Great that you were able to achieve your requirement.
Could you mark the answer as correct and hit like. Thanks in advance.
Regards
Ankur
Ankur
✨ Certified Technical Architect || ✨ 9x ServiceNow MVP || ✨ ServiceNow Community Leader