Mark HR case confidential and once its mark true then case should be visible to HR admin
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
03-11-2020 11:43 PM
Created a check box for HR case confidential . When its checked- true then the HR case should be only visible to HR admin.
I dont want to go with ACL . Any other way to approach this?
Thanks
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
03-11-2020 11:45 PM
Hi,
you can use query business rule for this; if you don't want ACL approach
Mark ✅ Correct if this solves your issue and also mark 👍 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
03-11-2020 11:49 PM
We have to write if condition right ? What code needs to be written to achieve this?
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
03-12-2020 12:00 AM
Hi,
So basically you want this:
1) So if the checkbox is true for any record then that record to be shown to below user
a) if logged in user is the opened_by person
2) if the checkbox is false then no restriction for the record
Does user with hr admin have no restriction; they can view all? if yes then I have added the BR not to trigger for admin and hr admin
BR: query business rule on sn_hr_core_case table
Condition: gs.getSession().isInteractive() && !gs.hasRole('admin') && !gs.hasRole('sn_hr_core.admin')
Script:
(function executeRule(current, previous /*null when async*/) {
if(current.<checkBox>){
current.addQuery('opened_by', gs.getUserID());
}
})(current, previous);
Mark ✅ Correct if this solves your issue and also mark 👍 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
03-12-2020 12:05 AM
Yes whenever any user checks on the mark confidential true/false field then opened for person in that HR case and anyone who has hr_admin role should be able to view the HR case no one else.
If the mark confidential is unchecked it should be visible to everyone.
insert and update BR should also be used with query BR right ?