Hi,
I'm facing the following problem. I'calculating a "defect value" using groovy scripts and the behaviours plugin. Now I need to integrate the value of the "affected version field" into my calculation. Not really the value but I'd map the version to a numeric value (like: current version 1.5.5--> value 10, next planned version 1.5.6--> value 9 etc. ).
So I either have to get the list and go on from there or copy the value to a custom text field. From there I know how to use the plugin to do what I want...
Can anyone help me out here? I guess I must obtain the versions with sth. like "issue.getAffectedVersions()" but I'm not sure how to really achieve this.
Any help is being appreciated,
Cheers Christian
Can you be a bit more specific about where you need help? What context is this, eg post-function, or behaviour script?
It sounds like you need the affected version field, then to work out your numeric value you also need to get the list of unreleased versions for that project, using VersionManager.getVersionsUnreleased(...).
Hey Jamie,
it's supposed be be a behaviours script. I got one script (see last part attached) calculation the "defect value" (mapped to defect value field)
// Define and map value FormField AGE = getFieldByName("Alter (Release)") //11514 def AGE_OPT = AGE.getFormValue() float AGE_VAL if (AGE_OPT == "10987"){ AGE_VAL = 4} else if (AGE_OPT == "10936"){ AGE_VAL = 3} else if (AGE_OPT == "10974"){ AGE_VAL = 2} else if (AGE_OPT == "10924"){ AGE_VAL = 1} else { AGE_VAL = 0} log.debug("--------------------Wert von AGE="+AGE_VAL) /* ################################ Berechnung Gesamtwert ##################################################*/ float GK_WEIGHT = 4.0 float DS_WEIGHT = 3.56 float KORR_WEIGHT = 3.11 float NEG_WEIGHT = 0.89 float BAKD_WEIGHT = 2.67 float GA_WEIGHT = 1.78 float WORK_WEIGHT = 1.78 float REP_WEIGHT = 0.89 float AGE_WEIGHT = 0.44 float Fehlerwert_float= (GK_VAL*GK_WEIGHT)+(DS_VAL*DS_WEIGHT)+(KORR_VAL*KORR_WEIGHT)+(NEG_VAL*NEG_WEIGHT)+(BAKD_VAL*BAKD_WEIGHT)+(GA_VAL*GA_WEIGHT)+(WORK_VAL*WORK_WEIGHT)+(REP_VAL*REP_WEIGHT)+(AGE_VAL*AGE_WEIGHT)
What I was planning to do now is read the "affected version field" value and set the "("Alter (Release)" custom field accordingly. (mapped to affects version field)
Sth. like:
FormField AGE = getFieldByName("Alter (Release)") <CODE to get the affectedVersion> if (affectedVersion == "1.5.1"){ AGE.setFormValue("10987") //renders to "Current Release" } else if(affectedVersion == "1.5.2") {AGE.setFormValue("10987") //renders to "Next Release" } ...
Hope that this explains my problem better than the information I had provided before.
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
Hi... I think I get what you're trying to do... ie perform a complicated calculation then set a form value. What's the actual problem - you can't get the fixVersions from the form? Try
getFieldById("fixVersions").getValue()
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
I needed the "affects Version" field. getFieldById("versions").getValue() did the trick! Don't know why this didn't work in the beginning. Maybe I had a typo. Thank you so much.
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.