Come for the products,
stay for the community

The Atlassian Community can help you and your team get more value out of Atlassian products and practices.

Atlassian Community about banner
4,364,806
Community Members
 
Community Events
168
Community Groups

How can I concatenate three custom field values and display it in fourth

I was trying below is giving me an error on setForm


def customFieldManager = ComponentAccessor.getCustomFieldManager()
def vrm = customFieldManager.getCustomFieldObject("customfield_14704")
def version = customFieldManager.getCustomFieldObject("customfield_14800")
def release = customFieldManager.getCustomFieldObject("customfield_14801")
def maintenance = customFieldManager.getCustomFieldObject("customfield_14802")


def versionval = issue.getCustomFieldValue(version) as double
def releaseval = issue.getCustomFieldValue(release) as double
def maintenanceval = issue.getCustomFieldValue(maintenance) as double
//def vrm = getFieldById("customfield_14803")
//def version = getFieldById("customfield_14800")
//def versionvalue = version.getValue() as double

//String s = version.concat("."+release).concat("."+maintenance)
//def x = issue.getCustomFieldValue(version) ++ issue.getCustomFieldValue(release)
//def y = versionval.concat("."+releaseval).concat("."+maintenanceval)


def y = versionval + "." + releaseval + "." + maintenanceval

if(versionval)
{
//version.setError("ghjghj")
vrm.setFormValue(y)
println(y)
}

1 answer

1 accepted

1 vote
Answer accepted

Hi @Syed Muhammad Umair Mansoor

What type of custom field are you using for vrm? Is it a Number Field or a normal Text Field?

When you are using the + operator along with the " " in:-

def y = versionval + "." + releaseval + "." + maintenanceval

you are converting the value to a String. If you intend the value to be a String, then your approach appears to be fine.

Thank you and Kind Regards,

Ram

Thanks for reminding about it, actually I need to change the type of custom field and need to put as INT for custom field value retrieval.

Suggest an answer

Log in or Sign up to answer
DEPLOYMENT TYPE
CLOUD
PRODUCT PLAN
FREE
TAGS

Atlassian Community Events