Showing results for 
Search instead for 
Did you mean: 
Sign up Log in

It's not the same without you

Join the community to find out what other Atlassian users are discussing, debating and creating.

Atlassian Community Hero Image Collage

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