This code snippet filters values from a collection of objects based on a condition
Iterate over the collection of objects and filter values that meet the condition
//Define an array to find and store the filtered values def newValues = issue.get("<Multi-valued field name>").findAll{ //Write the condition <Condition> } return newValues |
Placeholder | Description | Example |
---|---|---|
> | Name of the multi valued field | watches |
> | Condition to meet for the value to be filtered | it.getName() != issue.get("reporter").getName() |
The output of this snippet is a subset of the existing values of a multi-valued field which you could use in a Groovy expression, to
Send an email to all the customers watching the ticket using the Email issue post-function. For this, you need to add this script in the "Users from script" field in the post-function configurationĀ
return issue.get("watches").findAll{ it.isInProjectRole("Service Desk Customers",issue.get("project") ) } |
|