Hi All,
I have created a scripted field for issue age and created another scripted field to to describe the issue age but fails to populate the second custom field, can any oe help me to modify this code.
def Age = getCustomFieldValue("Issue Age in Days").getValue()
if (Age <= 180){
return "Less Than 6 months"
}
if (Age >= 180){
return "6-12 Months"
}
if (Age > 365){
return "More than 12 Months"
}
Thanks,
Ash.
Is the field a numeric field?
Both are scriptrunner scripted fields Nic, is it possible to display string type values in scripted field ?
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
That's not quite what I asked, but re-reading the question and that comment suggests an answer.
It sounds like you are trying to have one scripted field calculate something, and then a second do another calculation based on the first one.
Do not do that if the fields are on the same issue. It fails in interesting ways. You'll need to decouple it, so that both fields do the calculation independently.
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
Thanks for the reply Nic.
Here is what I'm doing, I have a scripted field which calculates issue age and displays in number format (1,2,3...) and I'm planning to have another scripted field on the same issue, if the number on the first scripted field is below 180 then second scripted field need to print "Less than 6 months" and if the number the number greater than 180 and less than 365 then second scripted field need to print "6-12 months" if the number on the first scripted field is greater than 365 then the second one need to print "more than 12 month"
this is the requirement so we can do reporting on this.
Thanks.
Ash.
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
Thank you, Nic.
Able to fix the code but don't know how these issues work in reporting.
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
I'm not sure what you're looking for help with now. I'll try to explain my answer differently and hope it helps a bit:
For the field "Age"
For the field "Age description"
You are doing the calculation twice, but it removes the dependency of one field on the other (which is what is going wrong here)
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
Thank you for the reply Nic, How accurate are these two values for reporting?. (We are using arsenal dataplane plugin for reporting)
I found this in my research, is there any update in scriptrunner plugin since this comment is in 2011.
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
There's *lots* of updates, but Jamie's comment absolutely stands here.
Your fields will be totally accurate in JIRA. Dataplane supports scripted fields if I understand it correctly, so you don't need to worry there either.
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.