- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
03-13-2017 02:06 PM
I'm trying to get certain options in the State field to hide if the current user is not a member of a group. The script I have so far is as follows:
function onLoad() {
var usr = g_user.getUserID();
var gate = g_form.getValue('u_field');
if (gate == 'true' && !usr.isMemberOf('GROUP')){
g_form.removeOption('state', '3'); //closed complete
g_form.removeOption('state', '4'); //closed incomplete
g_form.removeOption('state', '7'); //closed skipped
}
}
How do I get the opposite of 'isMemberOf'? I was thought it was an exclamation point (i.e. !usr.isMemberOf('group').
Thoughts?
Thanks in advance.
Solved! Go to Solution.

- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
03-13-2017 02:53 PM
Step 1: Create a display Business rule with script as. Place the below script between function templates in script body.
g_scratchpad.grp = gs.getUser().isMemberOf('PASS GROUP NAME HERE');
Now update the client script as
function onLoad() {
var usr = g_user.getUserID();
var gate = g_form.getValue('u_field');
if (gate == 'true' && !g_scratchpad.grp){
g_form.removeOption('state', '3'); //closed complete
g_form.removeOption('state', '4'); //closed incomplete
g_form.removeOption('state', '7'); //closed skipped
}
}
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
03-13-2017 03:11 PM
check this thread How do we call isMemberOf() from clientside?