Forums

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

How can I create an epic based on story transition ? Scriptrunner

Shawn Danisa May 16, 2018

I would like to automatically create an epic based on the story transition.  The story contains a multiselect field called favourite drink.

When a user selects a the option 'Tea', the epic should be automatically created in the Tea Project and when the user selects the option 'Coffee', the epic should be automatically created in the Coffee Project.

I tried to use ScriptRunner build in scripts but no luck. For testing purposes, I automatically created a story on the Tea project when the 'Tea' option is selected and it works well. But not working for the Epic.  I think the reason it may not be working is due to the Epic Name field not completed (I could be wrong)

 

Picture 1.JPG Picture 2.JPG

1 answer

1 accepted

0 votes
Answer accepted
Tarun Sapra
Community Champion
May 16, 2018

Hello @Shawn Danisa

What is the error you see in the log files? Is it due to an mandatory field like "Epic name" which you have to set while creating an epic. And if that's the case then you need to set that value in "Additional issue actions"

Shawn Danisa May 16, 2018 edited

Hi @Tarun Sapra

 

It's due to setting the Epic Name.

I had a look at this: https://scriptrunner.adaptavist.com/4.3.3/jira/recipes/behaviours/setting-default-fields.html 

But not sure how I would go about setting the epic name :( 

Tarun Sapra
Community Champion
May 16, 2018

In the "additional issue action" section you have to write this code, there are some sample already for "Set custom field" (click on expand examples)

def cf = customFieldManager.getCustomFieldObjects(issue).find {it.name == 'Epic Name'}
issue.setCustomFieldValue(cf, 'my value')

And place this post-function the last post-function field of the transition. (After "generic event" fired transition).

Suggest an answer

Log in or Sign up to answer
TAGS
AUG Leaders

Atlassian Community Events