Abstract
This code snippet filters values from a collection of objects based on a condition
...
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
Set a multi-valued field to a subset of the existing values in one of the Set field value post-functions and the Create issue post-function under Set fields of new issue section. Example: Set a Multi-user picker type field to the users in the Watchers field excluding the Reporter of the issuewho belong to the Europe/Berlin time zone:
Code Block language js linenumbers true def newValues = issue.get("watches").findAll{ it.getName() != issue.get("reporter").getName() } return newValues{{ issue.fields['Watchers'] | filter({"timeZone": "Europe/Berlin"}) | join(",","accountId") }}
Send an email to all the users of the Request Participants when a meeting schedule has been changed, except to the current user in the Email issue post-functionthe 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
Code Block language js linenumbers true def newValues =return issue.get("Request Participantswatches").findAll{ it.getNameisInProjectRole()"Service != currentUser.getName(Desk Customers",issue.get("project") ) } return newValues
References
- Variables used in a Groovy expression
- Issue interface
- Accessing the fields of an issue
- Groovy Documentation
...