Showing results for 
Search instead for 
Did you mean: 
Sign up Log in
Deleted user
0 / 0 points
badges earned

Your Points Tracker
  • Global
  • Feed

Badge for your thoughts?

You're enrolled in our new beta rewards program. Join our group to get the inside scoop and share your feedback.

Join group
Give the gift of kudos
You have 0 kudos available to give
Who do you want to recognize?
Why do you want to recognize them?
Great job appreciating your peers!
Check back soon to give more kudos.

Past Kudos Given
No kudos given
You haven't given any kudos yet. Share the love above and you'll see it here.

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

Setting the status of an issue upon creation with a groovy script Edited

Hello everybody,


I'm currently working on a script which automatically creates a story with subtasks on the first day of each month. I'm almost done with it, but I've noticed that I can't set the status of an issue upon creation. No matter what statusId I set as a parameter, the status of the created issues are always set to the default status (the first status in the workflow after creation). So for example, I'm trying to create an issue which upon creation has the status "to Do", but the issue is always set to "Backlog" (first status in the workflow).

relevant code:

def issueStatusId = "11"

def issueInputParameters_parent = issueService.newIssueInputParameters()

issueInputParameters_parent.with {
projectId = projectManager.getProjectObjByKey(projectKey).id
summary = summaryDesc
issueTypeId = issueTypeNameId
reporterId = reporterNameId
assigneeId = assigneeNameId
description = descriptionText
statusId = issueStatusId
priorityId =


def validationResult = issueService.validateCreate(user, issueInputParameters_parent)
assert !validationResult.errorCollection.hasAnyErrors()

def issueResult = issueService.create(user, validationResult) "Issue created: ${issueResult.issue}"

I've also tried setting the status like this:


But this returns the same result.


I'm aware that I can transition the issue status after creation, but I'd like to set the correct one right at creation, since my spaghetti code is already long enough.

Any help is greatly appreciated!



1 answer

1 accepted

1 vote
Answer accepted

Welcome to the community!

There's no way to set the status on creation.  The create "transition" lands at one point in the workflow.  It's a bit like a starting a railway journey, once you've bought a ticket and got on the train, the track ends at one fixed place and you can't change where it goes.

You'll need to do what you said - fast-track transition the issue after it's finished being created.

Thank you very much for your answer, Nic. Do you know why the method .setStatusId() even exists if every issue defaults to the first status of the associated worklflow, regardless of its value?

Suggest an answer

Log in or Sign up to answer

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