Hi there
I would like to calculate some number-fields in a post function with a custom script post-function (inline script) from script-runner.
As i heard from other companies that scripted fields slow down the performance, i would like to update the fields with a transition and calculate the summary in the postfunction.
At the end i have to summarize about 10 number-fields. No i try to catch the value from one field an put it in the targetfield. I get no error, but the targetfield is not updated.
I have search quite a lot, but there must be something with the setCustomFieldValue.
Can anyone help me to find and solve the problem or does anyone have a suggestion how i could solve this task in a better way?
Thanks a lot for your help.
Roman
// Imports
import org.apache.log4j.Level
import org.apache.log4j.Logger
import com.atlassian.jira.component.ComponentAccessor
// declare Logger
Logger log = Logger.getLogger("css.workflow.project.update")
log.setLevel(Level.INFO)
// declare Destination-Field
def customFieldManager = ComponentAccessor.getCustomFieldManager()
def fBusinessValueCalcld = customFieldManager.getCustomFieldObjectByName("Business Value Calculated")
log.info("Destination Field ID: ${fBusinessValueCalcld}")
// declare Field to read values (Numberr-Fields) - Total 10 Fields
def f1 = customFieldManager.getCustomFieldObjectByName("Value Strategiebezug")
def f1Value = issue.getCustomFieldValue(f1)?:null
// Logging Fields and Values
log.info("Field f1: ${f1.getFieldName()}")
log.info("Field Value f1: ${f1Value}")
if (f1) {
// set the value to the destinatio-field
issue.setCustomFieldValue(fBusinessValueCalcld, f1Value)
}