Hello All,
My Requirement is to Auto-Populate Summary field with concatenation of a Custom Field & Affect version field, I have achieved it with Script runner Behavior. Also, have allowed only one affect version selection.
Now part of the Script works well when Existing Affect version is selected but If NEW AFFECT VERSION is created during Issue creation, it adds 'null' instead of version, so it seems not able to recognize New Affect/s Version value.
Behavior added -> Field 'Affect Version' selected -> Below code is written in server side script section
{code}
-----------------
def OneAffectsVersion = getFieldById("versions")
Object AffectsVersion = getFieldById("versions").getValue();
String affectedVersion = null;
if (AffectsVersion instanceof ArrayList) {
//To Fetch Version value without []
if (AffectsVersion.size() > 0) {
affectedVersion = AffectsVersion.get(0) as String;
}
//To Allow only One affect version selection
if (AffectsVersion.size() > 1) {
OneAffectsVersion.setError("Build revisions may only have one affects version-New");
}
else OneAffectsVersion.clearError()
}
def CustomField= getFieldByName("CustomField").value
def summary = getFieldById("summary")
summary.setHidden(true)
summary.setFormValue("${CustomField} ${affectedVersion}")
------------------
Kindly share what is going wrong or needs to be added to Fetch dynamic New Affect version created
Let me know if I can explain more.