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
Hey i need you help please.
I would like to copy issues from a project to another after due date is passed.
I will put in place a job every 24 hours.
I work on jira 9.4.1 and scriptrunner 8.3.0.
I found other topics, i tried to build something but it's failed.
Anyone can help me please?
Hi @Suketa
From what you have described in your description, you are trying to copy over an issue from one project to another project after a certain time period.
There is already an example of how to copy the issue from one project to another project available in the Adaptavist Library.
Regarding the date when you want the script to execute, you could set something like an Escalation Service or a Custom Job to trigger the copying process.
I hope this helps to solve your question. :-)
Thank you and Kind regards,
Ram
It's ok for me.
I had to change def issueToCopy = issueManager.getIssueObject(issueKey)
by def issueToCopy = issueManager.getIssueObject(issueKey.getKey())
Thank you
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
I have tried something like this but an error occured. "IssueKey" can not be apply like this in method...
import com.onresolve.scriptrunner.runner.ScriptRunnerImpl
import com.onresolve.scriptrunner.canned.jira.utils.ConditionUtils
import com.onresolve.scriptrunner.canned.jira.workflow.postfunctions.CloneIssue
import com.atlassian.jira.component.ComponentAccessor
def projectkey = "AAAA"
Issues.search('project = BBBBB AND duedate > startOfDay()').each {issueKey ->
// do something
def projectManager = ComponentAccessor.projectManager
def issueManager = ComponentAccessor.issueManager
def projectToCopy = projectManager.getProjectByCurrentKey(projectkey)
def issueToCopy = issueManager.getIssueObject(issueKey)
def blockIntraprojectLinks = '{l -> l.sourceObject.projectObject != l.destinationObject.projectObject}'
//Set the creation parameters/inputs (use clone issue but with no link type)
def inputs = [
(CloneIssue.FIELD_TARGET_PROJECT) : projectToCopy.key,
(CloneIssue.FIELD_LINK_TYPE) : null,
(ConditionUtils.FIELD_ADDITIONAL_SCRIPT): [
"checkLink = $blockIntraprojectLinks;",
""
],
(CloneIssue.FIELD_SELECTED_FIELDS) : null, //clone all the fields
(CloneIssue.SKIP_EPIC_LINKS) : "true",
] as Map<String, Object>
def executionContext = [issue: issueToCopy] as Map<String, Object>
def newClonedIssue = ScriptRunnerImpl.scriptRunner.createBean(CloneIssue)
// Execute the clone action with the specified inputs
def updatedExecutionContext = newClonedIssue.execute(inputs, executionContext)
//The issue has been successfully cloned
assert updatedExecutionContext.newIssue
}
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.