/
Useful scripts
Useful scripts
Javascript vs Groovy
Scripts provided here are typically Javascript so will likely not work if directly pasted into a Groovy script editor, some tweaking may be required.
Groovy: getting a Regexp Pattern Class:
import java.util.regex.Pattern;
def pattern = Pattern.compile("([Gg])roovy")
assert pattern.class == Pattern;
print('pattern class: '+pattern.class);
Nashorn
Creating a pattern
var p = java.util.regex.Pattern.compile("test");
Creating Lists
var x = java.util.List.of("this","that");
print(x.getClass() + " has "+x.size() +" elements");
print("0 = "+x.get(0));
print("1 = "+x.get(1));
Working with recipient lists
Reuse of common loop variables in ‘for’ seems to break, use unique name for different loops.
Some javascript functions are not available in the Java ScriptEngine implementation, eg ‘in' and ‘list.includes’ are not supported, in such cases, you should implement a script to do the work, eg, here we work on to: and cc: to test if they are mailbox addresses referred in the common list:
Example Scripts
The following are scripts to solve some cases, may help you toward a solution, feel free to submit yours through support or comments!
, multiple selections available,
Related content
Create multiple issues from a single email
Create multiple issues from a single email
Read with this
Check for/Drop duplicate issues with same Sender, Summary and Description
Check for/Drop duplicate issues with same Sender, Summary and Description
Read with this
Performing HTTP requests
Performing HTTP requests
Read with this
Use Script Field Processor
Use Script Field Processor
Read with this
Use Regexp and JQL to create comments or Sub-tasks on existing issues.
Use Regexp and JQL to create comments or Sub-tasks on existing issues.
Read with this
Process Cc'd Jira user addresees into specific jira user fields with consideration of Project Roles
Process Cc'd Jira user addresees into specific jira user fields with consideration of Project Roles
Read with this