Find your people. Pick a challenge. Ship something real. The CreatorCon Hackathon is coming to the Community Pavilion for one epic night. Every skill level, every role welcome. Join us on May 5th and learn more here.

How can I hide records on a table based on the user's group?

jaredholm
Kilo Contributor

I would like to hide certain records on the Requested Item (sc_req_item) table based on a user's group or role.

For example, if a user submits a "Request to Pull Email" Service Catalog request, a record on the sc_req_item will be created. I want these requests to be only visible to users in the groups "ITSS-MRS Security" and "ITSS-ECS E-Mail". I have created a beforeQuery Business Rule that runs on records with item = 'Request to Pull Email', but I am having trouble with the code in the advanced section of the business rule (the code should go something like this):

if (user.group == "ITSS-MRS Security" || user.group == "ITSS-ECS E-Mail" || user.role == "admin") {
     visible = true
} else {
     visible = false
}

How do I finish this code so that only those users can see the records?

Thanks in advance.

8 REPLIES 8

Not applicable

Hey Shishir,

 

I tried this and it's not working.
Any idea why?

Replace sysid xxxx with Request to Pull Email‘s sysid

Not applicable

Hey Jaredholm,

Did you ever figure this out? I am having the same issue 

You could do the following in a query business rule

 

if (gs.getSession().isInteractive()) {
if (!gs.getUser().isMemberOf('GROUP ONE NAME')) {
if (!gs.getUser().isMemberOf('GROUP TWO NAME)) {
if (!gs.getUser().isMemberOf('GROUP THREE NAME)) {
current.addEncodedQuery('cat_item!=*SYS ID OF CATALOG ITEM*');
}
}
}
}