Forums

Articles
Create
cancel
Showing results for 
Search instead for 
Did you mean: 

How do I create a script post function when creating a new issue?

Barry Pickering February 27, 2019

Hi there,

I've just downloaded Scriptrunner to Jira cloud and want to add a post function script so that when I create a new issue, it automatically inherits the value entered in the associated epic.

From what I've read in the Community, it looks like I need to add a script to a workflow transition.

I'm struggling to understand which workflow needs editing. Are there specific workflows for issue creation that I need to configure?

I've never used Scriptrunner before, so am on a big learning curve...!

Thanks

 

 

 

2 answers

1 accepted

0 votes
Answer accepted
Kristian Walker _Adaptavist_
Community Champion
February 27, 2019

Hi Barry,

Thank you for your question.  

I can that in order to add a post function you should navigate to the project settings for the project which you wish to add the post function to which is located at the URL of <JiraBaseUrl>/secure/project/EditProject!default.jspa?pid=IdOfProjectHere.

Once on the project settings page, you should find the workflow that you want to edit and open it to edit in diagram mode and edit the transition where you wish to add the post function too.

You will then need to select the ScriptRunner Post-Function radio button and then the Run Script option on the screen that is displayed. This will then bring up a screen where you can enter the code for your post function. 

I can confirm that you can find more details of how to edit workflows inside of the Atlassian documentation pages located here.

I can also to confirm that to get started you can see lots of examples inside of the documentation pages located here and here as well as by clicking any of the links next to the Example text under any code box such as on the Script Console page.

If this response has answered your question can you please mark it as accepted so that other users can see it is correct when searching for similar answers.

Regards,
Kristian

Matthias Gaiser _K15t_
Community Champion
February 27, 2019

Hi Kristian,

out of curiosity - is this also possible for next-gen projects?

Cheers,
Matthias.

PS: You should change your name from rounded brackets to square brackets - otherwise it is not possible to mention you.

Kristian Walker _Adaptavist_
Community Champion
February 27, 2019

HI Matthias,

Thank  you for your response.

I can confirm that currently only standard Jira projects  support Jira post functions and that next gen prokects do not support these at this time.

Regards,

Kristian

Barry Pickering February 28, 2019

Hi Kristian,

Thanks for the very clear and detailed reply. I'll look to follow the steps and examples you mention and report back with progress.

Thanks again

Barry

0 votes
Matthias Gaiser _K15t_
Community Champion
February 27, 2019

Hi @Barry Pickering

you are right that you have to add a script to a workflow transition.

Since you're on Jira Cloud, the first step is to determine what type of project you are using. Jira Cloud differentiates between Next-Gen and classical projects. You can do so by checking out the bottom of your project settings:

next-gen-project.png

Classic project

If you're using a classic project, you can click on workflows in this menu and see what workflow is used for your project. Then you can edit that workflow and add your post function to the create transition:

create-transition.png

I hope this helps get you started. Let us know if you need more help.

Next-gen project

I think it is not supported for next-gen projects, but maybe someone else knows more.

Cheers,
Matthias.

Barry Pickering February 28, 2019

Hi Matthias thanks very much for the prompt reply.

I can confirm we are using Classic software projects. I've found the Create transition and will look to add the post function.

Cheers

Barry

Like Matthias Gaiser _K15t_ likes this

Suggest an answer

Log in or Sign up to answer
TAGS
AUG Leaders

Atlassian Community Events