Hi All,
I am a little lost with this. I am open to alternative solutions.
I have a problem: We periodically archive issues which have been closed and not updated for one year.
Teams are asking that we enable a solution to allow them to retrieve old issues so that they can search them. The solution is to allow the individual teams to Unarchive all of these issues, until the next archive process will archive them again.
We were thinking of using Fragments for this. But as far as I can tell Fragments can not execute some groovy script? they can only call an end point?
Is this correct?
This is a sample of a script we would want to execute.
import com.atlassian.jira.component.ComponentAccessor
import com.atlassian.jira.issue.archiving.ArchivedIssueService
def projectManager = ComponentAccessor.getProjectManager()
def issueManager = ComponentAccessor.getIssueManager()
def project = projectManager.getProjectByCurrentKey('TEST')
def issueIds = issueManager.getIssueIdsForProject(project.id)
def issues = issueManager.getIssueObjects(issueIds)
def archivedIssues = issues.findAll { it.isArchived() }
def um = ComponentAccessor.userManager
def archivedIssueService = ComponentAccessor.getComponent(ArchivedIssueService)
def techUser = um.getUserByName("Automation User")
for (item in issues) {
def validationArchive = archivedIssueService.validateRestoreIssue(techUser, item, false)
if (validationArchive.valid) {
archivedIssueService.restoreIssue(validationArchive)
}
}
What is the best way to implement this?
Also, I need to know how I can get the project key.
This is what I thought I could do:
Create Web Panel


This will give me something like a panel below:
