I'm already using the Listener "Clones an issue, and links" for transitions, but we have some older tickets that I'd like to apply the same logic. I suppose it's also possible for a post-function to not fire for some reason, so I'd like to implement the same functionality as an escalation service.
What I want is:
1. After 24 hours, if the following JQL returns any tickets:
project = FOOB and status = "In Progress" and issueFunction not in linkedIssuesOf("project=BAR")
2. Create a new issue in the BAR project with the same title as the matching issue in the FOO project.
3. Link the two issues with a "Relates to" issuelink type.
I, unfortunately, don't know Groovy, but it seems like I shouldn't have to rewrite this built-in functionality if possible. Any thoughts?
This is as far as I've progressed, but I'm also not sure how to test this:
import com.atlassian.jira.component.ComponentAccessor
import com.atlassian.jira.issue.IssueFactory
import com.atlassian.jira.issue.IssueManager
import com.atlassian.jira.issue.MutableIssue
import com.atlassian.jira.project.Project
import com.atlassian.jira.project.ProjectManager
def compAccessor = new ComponentAccessor();
def issueFactory = compAccessor.getIssueFactory();
def projectManager = compAccessor.getProjectManager();
def issueManager = compAccessor.getIssueManager();
def Project projectObj
projectObj = projectManager.getProjectByCurrentKey("BAR" as String)
def MutableIssue review = issueFactory.cloneIssue(issue)
review.setSummary(issue.getSummary())
review.setProjectId(projectObj.id)
We're on Jira 7.6.0 and ScriptRunner 5.4.12
Thanks!