- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
01-16-2024 09:47 AM
Looking for someone to share a working code
current configuration:
1st notification: (dont send this one if it is the group)
2nd notification (send this one if its that group)
Solved! Go to Solution.

- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
01-16-2024 11:24 AM
So if this will not work
if(!current.group && !current.group.assignment_group && current.group.assignment_group != "ec711d8d1b0921904d480d01cd4bcb11") {
answer = true
} else {
answer = false
}
Then you need to look at it from the perspective of what data do you have.
You know the approval record.
That means you know the requested item.
Which means you know the catalog item.
Since you know the catalog item you know the workflow
Since you know the workflow you know how it decides the group.
Which means you just need to duplicate that decision making process into your script so you can generate the same group and then check that value for the one you would like to avoid.
So if the simple if statement above will not work then your script needs to get a lot more complicated.

- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
01-16-2024 11:01 AM
I asked how you know the group and you said
"by a variable and the workflow:"
So what I gave you will work you just need to make the condition more complicated. Like adding a check for the specific catalog item and then check the variable for whatever value or run whatever code you use to decide the group and then see if it outputs the one you would like to avoid.
Also if the approval is part of a group approval you can get the group from
current.group.assignment_group
assuming current is a "sysapproval_approver" record.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
01-16-2024 11:10 AM
the variable is attached to an if condition in the workflow which then sends to an approval group request

- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
01-16-2024 11:24 AM
So if this will not work
if(!current.group && !current.group.assignment_group && current.group.assignment_group != "ec711d8d1b0921904d480d01cd4bcb11") {
answer = true
} else {
answer = false
}
Then you need to look at it from the perspective of what data do you have.
You know the approval record.
That means you know the requested item.
Which means you know the catalog item.
Since you know the catalog item you know the workflow
Since you know the workflow you know how it decides the group.
Which means you just need to duplicate that decision making process into your script so you can generate the same group and then check that value for the one you would like to avoid.
So if the simple if statement above will not work then your script needs to get a lot more complicated.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
01-16-2024 11:28 AM
that script worked! 🙂 rockstar! that was quite the struggle to figure out appreciate the work was quite the effort to figure out the combination of group but essentially since these groups are being only used for these approvals and you targetted just about every group it did the job!

- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
01-16-2024 11:32 AM
The more I think about it the more I think the if condition is wrong. I think it needs to be || and not &&.
The way it currently is I think it will cause the notification to only work if its not for a group approval. So I think it needs to be.
if(!current.group || !current.group.assignment_group || current.group.assignment_group != "ec711d8d1b0921904d480d01cd4bcb11") {
answer = true
} else {
answer = false
}
This way if there is No group it will work or if the assignment group is empty or if the assignment group is not the one value.