- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
02-23-2018 07:28 AM
Looking for a condition that will hide items from displaying in the Service Portal Header Menu. Right now, I have something that looks like this... GlideSPScriptable.canSeePage("services_status") && gs.getUser()... but need to restrict access, based-on those who are a member of a Department.
Thank you!
Solved! Go to Solution.
- Labels:
-
Scripting and Coding

- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
02-27-2018 10:28 PM
Condition should be GlideSPScriptable.canSeePage("services_status") && new bsu_system_status().getMyDepartmentID()
Use below script
var bsu_system_status = Class.create();
bsu_system_status.prototype = {
initialize: function() {
},
getMyDepartmentID: function() {
if (gs.getUser().getDepartmentID() == 'sysID1' || gs.getUser().getDepartmentID() == 'sysID2' || gs.getUser().getDepartmentID() == 'sysID3')
return true;
else
return false;
},
type: 'bsu_system_status'
};
Please mark this response as correct or helpful if it assisted you with your question.

- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
02-26-2018 09:23 AM
Can you post me the screenshot how you wrote the script?
Please mark this response as correct or helpful if it assisted you with your question.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
02-26-2018 02:38 PM
I figured-out the problem. The condition is too long for the input field. It gets cut-off towards the third department id. Thoughts?

- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
02-26-2018 03:26 PM
Ok. In that case you need a script include. call the function with new Scriptname().functionname()
So complete function will be GlideSPScriptable.canSeePage("services_status") && new Scriptname().functionname()
The script include should have a function with below script
if (gs.getUser().getDepartmentID() == 'sys_id1' || gs.getUser().getDepartmentID() == 'sys_id2' || gs.getUser().getDepartmentID() == 'sys_id3')
return true;
else
return false;
Please mark this response as correct or helpful if it assisted you with your question.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
02-27-2018 08:58 PM
Thanks! Here's what I currently have:
Condition:
GlideSPScriptable.canSeePage("services_status") && bsu_service_status().getDepartmentID()
Script Include:
var bsu_system_status = Class.create();
bsu_system_status.prototype = {
initialize: function() {
if (gs.getUser().getDepartmentID() == 'sysID1' || gs.getUser().getDepartmentID() == 'sysID2' || gs.getUser().getDepartmentID() == 'sysID3')
return true;
else
return false;
},
type: 'bsu_system_status'
};
SysID's are being replaced with actual departments. However, it does not work. Suggestions?

- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
02-27-2018 10:28 PM
Condition should be GlideSPScriptable.canSeePage("services_status") && new bsu_system_status().getMyDepartmentID()
Use below script
var bsu_system_status = Class.create();
bsu_system_status.prototype = {
initialize: function() {
},
getMyDepartmentID: function() {
if (gs.getUser().getDepartmentID() == 'sysID1' || gs.getUser().getDepartmentID() == 'sysID2' || gs.getUser().getDepartmentID() == 'sysID3')
return true;
else
return false;
},
type: 'bsu_system_status'
};
Please mark this response as correct or helpful if it assisted you with your question.