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-17-2024 10:59 PM
@Annie10 ,
You need to add the code at the last of the 1st line. Plz check the srn shot.
OR
You can remove the existing code & paste the below code.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
05-18-2024 03:39 AM
Hi @Annie10 ,
Why utilize a business rule and not a data filtration rule?
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-19-2024 11:37 PM
Hi @AndersBGS
That is because the Business Rule is the only method I am familiar with. I had never heard of a data filtration rule, but I gave it a try after hearing about it from you. However, when using Data Filtration Records to display only the records assigned to the Database group if you are a member of that group, it does not seem to be working.
1. Abel Tuter belong to 1 group "Database"
2. When I impersonated Abel Tuter, I should only see the Database records. However, I was able to see all records.
What have I done wrong with the Data Filtrations?
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
05-20-2024 11:53 PM
Hi @Annie10 ,
That is also correct. The data filtration rule will list which records specific users can see based on condition. So according to your screenshot, Abel (as part of database group), will be able to see database records.... people not part of the database assignment group will not be able to see the database records.
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-21-2024 10:36 AM
Hello @AndersBGS
Upon reevaluation of the screenshot, it's apparent that the data retrieved for Abel contains entries from a group he isn't a part of. There seems to be a misconfiguration in the data filtration process. Here are the same screenshots I posted earlier. Thank you