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

Create Issue in Jira

Hi All,


I want to create issue in jira script runner using Rest Api in groovy. Anybody can please help?

2 answers

1 vote

Could you tell us what you are trying to do?  Not how, but what?

Problem is you've said "create issue in Jira SR using REST API" - if you have SR, you don't need to use REST, you have direct access to the Jira you are in.  But you might also mean you're trying to create issues from somewhere else (in which case, you might not need SR, as Jira has a REST interface). 

We can clarify what the question is and hence get started on a proper answer.

Hi Nic,


The requirement is when  an issue of type Risk is moved to the workflow state of 'Occurred' then validate whether any issue of type "issue" is linked with the parent issue t "Risk", if yes then nothing will happen if no then we need to create an issue of type issue, and the Summary,description from the Risk is used as the Summary,description of the Issue.

I am trying to write the groovy script in validator custom script.

Ok, so nothing to do with REST.

I would do this with a post-function. You should NEVER try to make changes to anything in a validator - a validator is part-way through a process and should only ever say "yes, this is ok", or "no, your data does not fit, so we will not be proceeding with the transition". If you were to put issue updates in a validator, you will start finding them doing very odd things and possibly trashing your database.

So, a post-function on the "go to occurred" transition of the Risk workflow would need to
Go through the links on the current issue
Check if the far end is of type "issue"
If you cannot find one, then create one, copying summary and description from current issue

These two should help you put together code for that:

0 votes

Hi @Nitu Kumari

It depends on what kind of scenario you're scripting for.

I would suggest starting on Scriptrunner's wiki - click here to view it - you could achieve this with a listener or post-function, both of which have instructions and examples within their wiki :)


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