You're on your way to the next level! Join the Kudos program to earn points and save your progress.
Level 1: Seed
25 / 150 points
Next: Root
1 badge earned
Challenges come and go, but your rewards stay with you. Do more to earn more!
What goes around comes around! Share the love by gifting kudos to your peers.
Keep earning points to reach the top of the leaderboard. It resets every quarter so you always have a chance!
Join now to unlock these features and more
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)
with:
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.setAssignee(ComponentAccessor.jiraAuthenticationContext.loggedInUser)
newSubTask.setSummary("Subtask for " + issue.key )
newSubTask.setDescription("Navigate to parent (eg. just click: [" + issue.key + "]) for details")
newSubTask.setParentObject(issue)
newSubTask.setProjectObject(issue.projectObject)
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 :)