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

Next challenges

Recent achievements

  • Global
  • Personal

Recognition

  • Give kudos
  • Received
  • Given

Leaderboard

  • Global

Trophy case

Kudos (beta program)

Kudos logo

You've been invited into the Kudos (beta program) private group. Chat with others in the program, or give feedback to Atlassian.

View group

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

Archive Issue using a post-function

I am tying to setup a workflow transition to archive issues. To do this I am trying to use a ScriptRunner Post Function script.

import com.atlassian.jira.issue.archiving.ArchivedIssueService
import com.atlassian.jira.issue.archiving.ArchivedIssueService.ValidationResult
import com.atlassian.jira.issue.archiving.ArchivedIssueService.ArchivingResult
import com.atlassian.jira.component.ComponentAccessor
import org.apache.log4j.Logger
import org.apache.log4j.Level

def log = Logger.getLogger("com.wmic.archive")
log.setLevel(Level.DEBUG)

ArchivedIssueService archivedIssueService = ComponentAccessor.getComponent(ArchivedIssueService.class)

ValidationResult validationResult = archivedIssueService.validateArchiveIssue(ComponentAccessor.getJiraAuthenticationContext().getLoggedInUser(), issue.getKey(), true)

if (validationResult.isValid())
log.debug("Archiving issue ${issue.getKey()}: ${archivedIssueService.archiveIssue(validationResult).isValid()}")
else
log.error("Failed to archiving issue ${issue.getKey()}: Validation Failed")
false

 

Everything logs as though it is succeeding. archivedIssueService.archiveIssue(validationResult).isValid() returns true. However the issue remains unarchived. What am I doing wrong?

Thanks in advance,
Carl

0 answers

Suggest an answer

Log in or Sign up to answer
TAGS

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