Please help with Business Rule Script conditions.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
05-17-2024 06:24 PM
Hello,
Could someone please help review the code? It is not working. The purpose of the business rule is to allow users to see records that are assigned to their team, but not records assigned to other teams. Thank you.
When to Run: Before, Query
(function executeRule(current, previous /*null when async*/) {
if (!gs.hasRole("itil") && gs.getSession().isInteractive()) {
var u = gs.getUserID();
var qc = current.addQuery("requested_for", u).addOrCondition("opened_by", u).addOrCondition("watch_list", "CONTAINS", u).addOrCondition('assignment_group', '927934e41b6bf0104425cb35624bcbe9');
gs.info("query restricted to user: " + u);
current.addQuery('assignment_group', '927934e41b6bf0104425cb35624bcbe9');
}
})(current, previous);
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
05-22-2024 03:18 AM
Hi @Annie10 ,
The data filtration rule is not about what specified users should not see, but more about what the general user should not see. E.g. if any user not part of the database team, the data filtration will work, and they will not be able to see the database tickets.
if my answer has helped with your question, please mark my answer as accepted solution and give a thumb up.
Best regards
Anders
If my answer has helped with your question, please mark my answer as the accepted solution and give a thumbs up.
Best regards
Anders
Rising star 2024
MVP 2025
linkedIn: https://www.linkedin.com/in/andersskovbjerg/
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
05-22-2024 08:28 AM
Hi @AndersBGS
Thank you for the explanation. I learned some new things today.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
05-20-2024 12:05 AM
@Annie10
why don't you try ACL with security _admin role and not business rule, but still if you want to try then take all the conditions and put it in filter condition of the table list view and then add
object.addEncodedquery()// to setup the user
for eg. if(gs.hasRole('itil')
{
current.addEncodedQuery('active=true');
})
Please accept the solution /mark this response as correct or helpful if it assisted you with your question.
Regards,
Animesh
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
05-20-2024 08:00 AM
Hi @AnimeshP_96
I would like to learn a method for filtering data. If you don't mind, could you capture a few screenshots so I can use them as a guide? Thank you.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
05-22-2024 12:47 AM
@Annie10
what you mean by filter?
can you give me any example so that i could tell you
Please accept the solution /mark this response as correct or helpful if it assisted you with your question.
Regards,
Animesh