- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
11-08-2024 05:12 AM - edited 11-08-2024 05:14 AM
Hi all!
We have Business rule at sys_user table, that using "current.addActiveQuery()" if current user is not admin.
At one of our Catalog Items at Service portal we need to show all users, not only active.
Is there any solutions how to check where we are from BR?
Solved! Go to Solution.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
11-08-2024 06:26 AM
It sounds like you have a query Business Rule. You can set your advanced reference qualifier to
activeANYTHING
preceded with a ^ if you are appending to an existing value.
In your query Business Rule, change the script to this, incorporating the admin check if that is in the script
(function executeRule(current, previous /*null when async*/) {
var query = current.getEncodedQuery()
if (gs.getSession().isInteractive() && !query.includes('activeANYTHING')) {
current.addActiveQuery();
}
})(current, previous);
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
11-08-2024 06:26 AM
It sounds like you have a query Business Rule. You can set your advanced reference qualifier to
activeANYTHING
preceded with a ^ if you are appending to an existing value.
In your query Business Rule, change the script to this, incorporating the admin check if that is in the script
(function executeRule(current, previous /*null when async*/) {
var query = current.getEncodedQuery()
if (gs.getSession().isInteractive() && !query.includes('activeANYTHING')) {
current.addActiveQuery();
}
})(current, previous);
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
11-08-2024 07:29 AM - edited 11-22-2024 04:49 AM
delited
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
11-08-2024 07:42 AM
Hi! Thanks for your answer, but it's not actually that i'm looking for.
I need to ignore addActiveQuery() if we are on the specific item
I was trying this code but it doesn't work
var query = current.getEncodedQuery();
if (!query.includes('myItemID')) {
current.addActiveQuery();
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
11-08-2024 04:28 PM - edited 11-09-2024 04:06 AM
The solution I provided will also work for specific Catalog Item(s) as you are only setting the reference qualifier on a variable in the specific item(s) - this can be just one item for now, then you don't need to change the script when the next case comes along. You need to change the reference qualifier and Business Rule script to that shown in the solution. You can use this with your existing Condition so that the script doesn't run if the current user has the admin or user_admin role. Since this already includes .isInteractive, you can omit the first condition from the if statement in the script.
(function executeRule(current, previous /*null when async*/) {
var query = current.getEncodedQuery()
if (!query.includes('activeANYTHING')) {
current.addActiveQuery();
}
})(current, previous);
