Come for the products,
stay for the community

The Atlassian Community can help you and your team get more value out of Atlassian products and practices.

Atlassian Community about banner
Community Members
Community Events
Community Groups

Some Groovy Classes Backwards-incompatible (ScriptRunner upgraded to 5.6.7)

For CloneIssue, it was enough for me to replace :

def params = [
issue : issue,
(CloneIssue.FIELD_TARGET_PROJECT) : issue.project.key,
(CloneIssue.FIELD_SELECTED_FIELDS) : null, //clone all the fields
] as Map<String, Object>
new CloneIssue().doScript(params)


MutableIssue newIssue = ComponentAccessor.issueFactory.cloneIssueWithAllFields(issue)
newIssue.created = new Timestamp(System.currentTimeMillis())
Map<String,Object> newIssueParams = ["issue":newIssue] as Map<String,Object>
ComponentAccessor.issueManager.createIssueObject(issue.creator , newIssueParams)

Not sure how it worked for CreateSubTask. Here is a code snippet from my script:

MutableIssue newSubTask = ComponentAccessor.issueFactory.issue
newSubTask.setSummary("Subtask for " + issue.key )
newSubTask.setDescription("Navigate to parent (eg. just click: [" + issue.key + "]) for details")
newSubTask.setIssueTypeId(ComponentAccessor.constantsManager.allIssueTypeObjects.find{ it.getName() == "Sub-approval"}.id)
// Add any other fields you want for the newly created sub task
Map newIssueParams = ["issue" : newSubTask] as Map
ComponentAccessor.issueManager.createIssueObject(ComponentAccessor.jiraAuthenticationContext.loggedInUser, newIssueParams)
ComponentAccessor.subTaskManager.createSubTaskIssueLink(issue, newSubTask, ComponentAccessor.jiraAuthenticationContext.loggedInUser)

I hope it helps :)



Log in or Sign up to comment

Community Events

Connect with like-minded Atlassian users at free events near you!

Find an event

Connect with like-minded Atlassian users at free events near you!

Unfortunately there are no Community Events near you at the moment.

Host an event

You're one step closer to meeting fellow Atlassian users at your local event. Learn more about Community Events

Events near you