- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎04-30-2017 08:21 PM
Hi team,
I want to hide a service portal category item for all users NOT belonging to a specific group. I have created a SCRIPT INCLUDE and a CATALOG CLIENT SCRIPT to do this task. I have successfully done it to hide the item for users with a specific service level. But i cannot seem to figure out how to do this for a group as i cannot use isMemberOf() in the client side. I have attached the screen shots i have done for the service levels. Please advise me on how i can hide the specific category item based on the user group.
This is the SERVER SIDE SCRIPT (Script Include)
This is the CATALOG CLIENT SCRIPT
All help is appreciated.
Thank you Team
Solved! Go to Solution.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎04-30-2017 10:49 PM
Hi Thiraj,
gs.getUser().isMemberOf('<group name or sys_id>') will work fine in your script include.
code in SI:
if(gs.getUser().isMemberOf('Premium Plus')){
return true;
}
return false;
Client Script ... code in display function...
var groupValue = response.respo ...........;
if(!groupValue){
g_form.removeOption(. ... .. ;
}
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎04-30-2017 10:49 PM
Hi Thiraj,
gs.getUser().isMemberOf('<group name or sys_id>') will work fine in your script include.
code in SI:
if(gs.getUser().isMemberOf('Premium Plus')){
return true;
}
return false;
Client Script ... code in display function...
var groupValue = response.respo ...........;
if(!groupValue){
g_form.removeOption(. ... .. ;
}
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎05-02-2017 05:14 PM
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎05-02-2017 05:16 PM
it should be group name , can you try with group name?
gs.getUser().isMemberOf('<group name>')
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎05-02-2017 05:22 PM
Hi Srnewbie,
I have tried it with group name as well but still no luck. I am not sure what i am missing here. According to my alerts it does not reach the inside of the if condition. Alert"here1" works fine. But the alert within the if condition does not get picked up. So i think it is something with the if condition or the answer coming back from the script include is incorrect. Please let me know what you think.
Thank you