- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
06-26-2017 09:18 AM
I wrote the following if script in one of my workflows:
function ifScript() {
if (current.variables.groups_needed == 'ROLE_CAIS SSO') {
return 'yes';
}
return 'no';
}
The "Groups Needed" filed can contain more than one answer. what operator can I use instead of "==" so that if the field contains ROLE_CAIS SSO it will still return true?
Thanks,
Vince
Solved! Go to Solution.

- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
06-26-2017 09:30 AM
Another thing you might consider is adding toLowerCase() so you don't have to worry about the case:
if (current.variables.groups_needed.toString().toLowerCase().indexOf('role_cais sso') > -1) {

- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
06-26-2017 09:25 AM
Hi Vince,
You can do a sort of contains search using something like:
if (current.variables.groups_needed.toString().indexOf('ROLE_CAIS SSO') > -1) {
That being said, this would only work if the groups_needed variable is a single or multiline text variable. If it's a list collector variable it's going to store values as a comma separated list of sys_ids.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
06-26-2017 09:27 AM
It's a multiline text filed. I will try this.
Thanks,
Vince

- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
06-26-2017 09:30 AM
Another thing you might consider is adding toLowerCase() so you don't have to worry about the case:
if (current.variables.groups_needed.toString().toLowerCase().indexOf('role_cais sso') > -1) {
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
06-26-2017 09:48 AM
That worked! Thanks!