Hide and display record per User Roles
Options
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
04-15-2024 01:31 AM
Hi ! I need to display case records with Numbers starting with the word "RIQ" with the role "sn_customerservice.customer". Below is my code in Business Rule which is currently not working. Everyone please give me the solution to this problem!
Thanks !
(function executeRule(current, previous /*null when async*/) {
var allowedRole = "sn_customerservice.customer";
var currentUser = gs.getUser();
var userRoles = currentUser.getRoles();
if (userRoles.indexOf(allowedRole) == -1) {
if (c.data.list) {
var filteredList = [];
for (var i = 0; i < c.data.list.length; i++) {
var record = c.data.list[i];
if (record.number && record.number.value && record.number.value.startsWith("CS")) {
filteredList.push(record);
}
}
c.data.list = filteredList;
}
}
})(current, previous);
1 REPLY 1
Options
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
04-15-2024 06:58 AM
@jasoncao Please refer the below link :
https://www.servicenow.com/community/developer-forum/hide-show-record-as-per-roles/m-p/2245979
Please mark this as helpful and accept it as a solution if this resolves your query.
Thanks,
Sujatha V.M.
Please mark this as helpful and accept it as a solution if this resolves your query.
Sujatha V.M.
Sujatha V.M.