Update issue status with IssueInputParameters does not work

I want to update the status from all issues in a proejct with this code, but it doesnt work:

But if i just update the description this works fine, but not for the status.
I tried different ids but nothing helped.


 Collection<Long> issueIds = getIssuesIdsFromProject(clonedProject);
IssueService issueService= ComponentAccessor.getIssueService();
for(Long id:issueIds){
MutableIssue issue=getIssueFromId(id);

IssueInputParameters issueInputParameters = issueService.newIssueInputParameters();
UpdateValidationResult updateValResult = issueService.validateUpdate(currentUser, issue.getId(), issueInputParameters);

IssueResult updateResult = issueService.update(currentUser, updateValResult);

throw new RuntimeException("Status for Issue" + issue.getKey() + "not valid");



Is this even possible with the setStatusId Method or do i need to traverse all transtion actions which would be much more effort to implement?

1 answer

0 votes


You cant not use setStatusId to transition issue. Your code would look like that:

def issueInputParameters = issueService.newIssueInputParameters()
            issueInputParameters.with {
            def validationResult = issueService.validateTransition(user, issue.id, 12, issueInputParameters)
            if (validationResult.isValid()) {
                def issueResult = issueService.transition(user, validationResult)
                if (! issueResult.isValid()) {
                    log.warn("Failed to transition task ${destIssue.key}, errors: ${issueResult.errorCollection}")
            } else {
                log.error("Could not transition")

 If your desired status does not have a direct transition to the required status you need to go through all transitions to reach it.

Actually you can create transitions from all statuses to required status . Choose in the workflow settings From status: Any status To status: <your status>.In this case you can always go from any status to the required status. Also add Hide transition from user condition to hide these transitions Jira users.

Ok thank you for your answer.

Is this programmatically possible with java to create new transitions at runtime?

The problem is that is should work for any workflows. So i dont know which actions are available to reach the state.

Or is there a way to get all outgoing transitions with the corresponding actions from the current status of the issue ?
I think this would be the easiest approach to solve my problem.

Yes, you can get all outgoing transitions. The code would be like this

IssueWorkflowManager issueWorkflowManager = ComponentAccessor

def actions = issueWorkflowManager.getAvailableActions(issue, user) 

Suggest an answer

Log in or Sign up to answer
Community showcase
Published Jan 08, 2019 in Jira

How to Jira for designers

I’m a designer on the Jira team. For a long time, I’ve fielded questions from other designers about how they should be using Jira Software with their design team. I’ve also heard feedback from other ...

1,092 views 4 9
Read article

Atlassian User Groups

Connect with like-minded Atlassian users at free events near you!

Find a group

Connect with like-minded Atlassian users at free events near you!

Find my local user group

Unfortunately there are no AUG chapters near you at the moment.

Start an AUG

You're one step closer to meeting fellow Atlassian users at your local meet up. Learn more about AUGs

Groups near you