Forums

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

Story point and story point estimate (duplicate?) fields

Alexander Brockhoff
I'm New Here
I'm New Here
Those new to the Atlassian Community have posted less than three times. Give them a warm welcome!
October 1, 2018

Hi all

On my Jira Cloud instance I have two fields, one called Story Points, one called Story points estimate.

The Story points estimate field is reserved in the custom field view so that I cannot delete it, while the Story Points field is not. I took this to assume one was custom created while the other was from Jira.

However, it seems Jira by default is using the Story Points field on the views for my issues and in the reporting for velocity etc. 

Is there something I am doing wrong? What is the proper use of each field? The estimate field doesn't make much sense to me as a field since the Story Points field seems to track changes to itself over time/in a sprint.

3 answers

1 accepted

1 vote
Answer accepted
Thanos Batagiannis [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 Champions.
January 7, 2016

Hi Melissa,

You can add a listener, as you described admin > script Listeners > Custom Listener, assign the project / projects you want and for the events you should select Issue Updated (therefore every time there is a change at the radio button custom field the listener will get triggered). For inline script copy / paste the script below

import com.atlassian.jira.component.ComponentAccessor
import com.atlassian.jira.issue.Issue
import com.atlassian.jira.issue.ModifiedValue
import com.atlassian.jira.issue.customfields.option.LazyLoadedOption
import com.atlassian.jira.issue.util.DefaultIssueChangeHolder

Issue issue = event.issue

def customFieldManager = ComponentAccessor.getCustomFieldManager()
def customField2 = customFieldManager.getCustomFieldObjectByName("radioBtn")
LazyLoadedOption radioBtnOption = (LazyLoadedOption) issue.getCustomFieldValue(customField2)

def changeHolder = new DefaultIssueChangeHolder();
def customField4 =  customFieldManager.getCustomFieldObjects(issue).find {it.name == "textfield"}


if (radioBtnOption?.getValue() == "No") {
    customField4.updateValue(null, issue, new ModifiedValue(issue.getCustomFieldValue(customField4), ""),changeHolder)
}

What it does: If the value of the custom field "radioBtn" is "No" then it updates the value of the custom field with name "textfield" with an empty string. This applies only for text custom fields. Hope that helps.

Edit: Now with Kristian's script you have two options. Via a behaviour or a Listener. Choose which suits your needs. 

Kind regards

mel vega
Contributor
January 10, 2016

thanks to you both Thanos and Kristian

2 votes
Kristian Walker _Adaptavist_
Community Champion
January 7, 2016

Hi Mel,

You can do this with Behaviours. I have enclosed a sample script below which checks the value in Radio Button A and when option 1 is selected clears the value in Radio Button B.

Note that by default JIRA excludes the none option from the options map so we have to include this before we can set the value to no value selected (none).

The documentation here shows example code of how you could set a radio button option if required.

// Get the custom fields by Name
def radioA = getFieldByName("Radio A")
def radioB = getFieldByName("Radio B")
// get the value of Radio A
String radioAVal = radioA.getValue()
//Define the option for none as Jira does not include this in the radio fields map by default
 Map radioBFieldOptions = [:]
    radioBFieldOptions.put ("-1", "None")
// If the value selected in Radio Button A is 1
if (radioAVal == "1") {
    // Set Radio Button B to None to clear its value
    radioB.setFormValue(-1)
}

I hope this helps

Thanks

Kristian

0 votes
Phill Fox
Community Champion
January 7, 2016

You could action this with a script as a post-function action if the changes are only going to be made during transitions. But if it could be altered using the edit functionality you do indeed need to use a listener. 

One option for you is to use ScriptRunner and you may want to review the documentation at https://scriptrunner.adaptavist.com/latest/jira/listeners.html for how listeners work and https://scriptrunner.adaptavist.com/latest/jira/recipes/workflow/postfunctions/set-issue-attributes.html for an example of how to set issue attributes.

Hope this helps.

mel vega
Contributor
January 7, 2016

Hi Phill, Indeed my problem concerns the edit functionnality. Thanks for the doc. i'm going to go through it

Phill Fox
Community Champion
January 7, 2016

@Thanos Batagiannis [Adaptavist] can you help here? Have you got an example script that you could share with @mel vega

Suggest an answer

Log in or Sign up to answer