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

Syed Muhammad Umair Mansoor May 24, 2021

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
Ram Kumar Aravindakshan _Adaptavist_
Community Leader
Community Leader
Community Leaders are connectors, ambassadors, and mentors. On the online community, they serve as thought leaders, product experts, and moderators.
May 28, 2021

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

Syed Muhammad Umair Mansoor May 29, 2021

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
AUG Leaders

Atlassian Community Events