Setting default value for Story Points using behaviors plugin

Hi,

I am trying to use an initialiser to set the Story Points field to 1 on the Create Issue action. 

import com.atlassian.jira.component.ComponentAccessor
if (getActionName() != "Create Issue") {
    return
        }
    
def storypoints = getFieldById("customfield_10002")  
int defaultVal = 1
storypoints.setFormValue(defaultVal)

The above is not working, and I'm not sure why. When I remove the condition, it sets the value, but I need it to only set on Create. 

Thanks!

1 answer

Hello Angela.

 

Try the following:

import com.atlassian.jira.component.ComponentAccessor
if (getActionName() != "Create Issue") {
    log.debug("MY ACTION NAME IS:" + getActionName())
    return
        }
    
def storypoints = getFieldById("customfield_10002")  
int defaultVal = 1
storypoints.setFormValue(defaultVal)

That will insert a string in your log as a debug with the name of your action name, that way you will be able to know why it is failing. 

Furthermore if you trigger the behaviour in the Create Issue dialog you will be able to know what to place into the condition.

Hope this helps, if it doesn't, let me know here and I will debug this for you.

Cheers!

Dyelamos

 

Suggest an answer

Log in or Sign up to answer
How to earn badges on the Atlassian Community

How to earn badges on the Atlassian Community

Badges are a great way to show off community activity, whether you’re a newbie or a Champion.

Learn more
Community showcase
Published yesterday in Jira

5 ways you can make the most of Jira Software and Bitbucket Cloud

As part of the Bitbucket product team I'm always interested in better understanding what kind of impact the use of our tools have on the way you work. In a recent study we conducted of software devel...

53 views 0 5
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