Condition if a user is not a member of a group
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎11-17-2014 12:48 PM
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!
- Labels:
-
Service Mapping
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎11-18-2014 11:38 AM
you shoudl be able to put an ! in front of the same condition as testing for to make it a not.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎11-18-2014 11:54 AM
I'm adding this into the advanced script field in a notification.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎11-18-2014 11:56 AM
can you post the code that works for if they ARE a member and or what you have so far?
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎11-18-2014 02:14 PM
Before I get ahead of myself, the point of this is to send an alternate notification when there someone is part of a VIP group.
The ones that are currently in production are horrible and one of the managers have asked to have this done. Eventually, this will won't be necessary once all the notifications are revised. The ones below seem to work.
Standard notification:
Active is true
Task type is "Ticket" (Custom)
Table is "ticket" (Custom)
Adv Script
if (gs.getUser(current.task_for).isMemberOf('VIP Users')) {
answer = false;
} else {
answer= true;
}
The VIP notification is the same except for the adv script:
gs.getUser().getUserByID(current.task_for).isMemberOf('VIP Users');
The other notifications sit on the incident table and I've also experimented with caller_id but that doesn't seem to work either. I believe that our ticket table is extended from task.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎11-18-2014 02:20 PM
ok if i am not mistaken... to tell if they are not a member in the most economical method you could just put an ! in front of the gs.getUser.... that whole thing will return true if the user is a member of VIP users.. and if you put an ! in front of it.. it should flip <not> the results...
however a far simpler method would seem to be to just flip where you put your true and false.