Page tree

Versions Compared

Key

  • This line was added.
  • This line was removed.
  • Formatting was changed.

定义字段

Image Added

编写脚本

Code Block
languagetext
linenumberstrue
import com.atlassian.jira.component.ComponentAccessor
import com.atlassian.jira.issue.Issue


// the values of that custom field - of type number - we want to sum up
final String
 

final Long customFieldName1 = "Number1"11700L;//期望效果
final StringLong customFieldName2 = "Number2"11701L;//成功信心


def customField1 = ComponentAccessor.customFieldManager.getCustomFieldObjects().findByNamegetCustomFieldObject(customFieldName1);
def customField2 = ComponentAccessor.customFieldManager.getCustomFieldObjectsgetCustomFieldObject(customFieldName2).findByName(customFieldName1)


def num1 = ;
if(customField1==null||customField2==null){
  0d;
}

def cfValue1 = (Double)issue.getCustomFieldValue(customField1);
if(!cfValue1){
  cfValue1 as Double;= 0d
}

def num2cfValue2 = (Double)issue.getCustomFieldValue(customField1) as Double;

num1+num2;(customField2);
if(!cfValue1){
  cfValue1 = 0d
}

cfValue1 + cfValue2