- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎10-06-2016 05:00 PM
I am trying to have a menu item show up only for people in certain groups, which we identify by a parent group field.
In the menu condition field, I can put javascript:(gs.getUser().isMemberOf('groupname')); if I want to only narrow it down to one group. I have written a script to combine the groups in the background into one group as a workaround.
But, what I'd really like is to do something like javascript:(ScriptLibrary.functionname(gs.GetUser())); and create my own script include that returns true or false. Has anyone done this? I have tried having my function just return true or just return false, without any code, and it doesn't show/hide the menu item like it should. So, I'm not sure if it can't be done, or if I'm just not calling the function properly.
I can put in screenshots if that helps. Thanks!
Solved! Go to Solution.

- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎10-06-2016 07:42 PM
If you have created you own Script Include called ScriptLibrary, then the correct way to call it would be:
javascript: new ScriptLibrary().functionname()
You don't really need to pass gs.getUser() as an argument because it's available from with the Script Include.
Your Script Include would look like this:
var ScriptLibrary = Class.create();
ScriptLibrary.prototype = {
initialize: function() {
},
functionname: function() {
var userObj = gs.getUser();
return true;
},
type: 'ScriptLibrary'
};
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎10-06-2016 07:16 PM
Please put the screenshots. It will help.

- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎10-06-2016 07:42 PM
If you have created you own Script Include called ScriptLibrary, then the correct way to call it would be:
javascript: new ScriptLibrary().functionname()
You don't really need to pass gs.getUser() as an argument because it's available from with the Script Include.
Your Script Include would look like this:
var ScriptLibrary = Class.create();
ScriptLibrary.prototype = {
initialize: function() {
},
functionname: function() {
var userObj = gs.getUser();
return true;
},
type: 'ScriptLibrary'
};
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎10-07-2016 05:49 AM
Thanks! I couldn't find that syntax anywhere!