Condition if a user is not a member of a group

KB15
Giga Guru

It's simple Javascript question:

I'm looking to find how to check if a caller is not part of a group in a notification. I've successfully used isMemberOf to check for a group but not the reverse.


Any help would be appreciated!

10 REPLIES 10

KB15
Giga Guru

Would this be an acceptable script?



if (gs.getUser().getUserByID(current.task_for).isMemberOf('VIP Group')) {


  answer = false;


  } else {


  answer= true;


  }


I believe you can shorten it to:



if (gs.getUser().isMemberOf("VIP Group"))


{


        return true;


}


else


{


        return false;


}


KB15
Giga Guru

Unfortunately, I don't think my code evaluates correctly. Also SN had an issue with "return true.". It wouldn't accept it as valid code.


Where is this code being executed?   Is it a workflow script?   If so, you will need to set answer to "true" or "false" like you did in your original post.