Create
cancel
Showing results for 
Search instead for 
Did you mean: 
Sign up Log in
Celebration

Earn badges and make progress

You're on your way to the next level! Join the Kudos program to earn points and save your progress.

Deleted user Avatar
Deleted user

Level 1: Seed

25 / 150 points

Next: Root

Avatar

1 badge earned

Collect

Participate in fun challenges

Challenges come and go, but your rewards stay with you. Do more to earn more!

Challenges
Coins

Gift kudos to your peers

What goes around comes around! Share the love by gifting kudos to your peers.

Recognition
Ribbon

Rise up in the ranks

Keep earning points to reach the top of the leaderboard. It resets every quarter so you always have a chance!

Leaderboard

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

Suggest an answer

Log in or Sign up to answer
0 votes
Daniel Yelamos [Adaptavist]
Rising Star
Rising Star
Rising Stars are recognized for providing high-quality answers to other users. Rising Stars receive a certificate of achievement and are on the path to becoming Community Leaders.
Jun 12, 2017

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

 

TAGS
AUG Leaders

Atlassian Community Events