Are you in the loop? Keep up with the latest by making sure you're subscribed to Community Announcements. Just click Watch and select Articles.

Showing results for 
Search instead for 
Did you mean: 
Sign up Log in

Earn badges and make progress

You're on your way to the next level! Join the Kudos program to earn points and save your progress.

Deleted user Avatar
Deleted user

Level 1: Seed

25 / 150 points

Next: Root


1 badge earned


Participate in fun challenges

Challenges come and go, but your rewards stay with you. Do more to earn more!


Gift kudos to your peers

What goes around comes around! Share the love by gifting kudos to your peers.


Rise up in the ranks

Keep earning points to reach the top of the leaderboard. It resets every quarter so you always have a chance!


How to get populate summary field with custom field value Select List (cascading) with only text


I have copied and adjusted a code from here. I just have one issue with that. I want to populate summary field based on Select List (cascading). When I run sucessfully this code, it returns the value in this format: Objednávka [null:Audit staff, 1:Travel Tickets]. Is it possible to get rid of the null, parenthesis and the number? I just need the text from the field. I spend like 4 hours looking for the solution but nothing worked for me. 

Could you please take a look at my code? 


import com.atlassian.jira.component.ComponentAccessor

def customFieldManager = ComponentAccessor.getCustomFieldManager()

def myCustomField1 = customFieldManager.getCustomFieldObjectByName('Typ objednávky a předmětu')

def value1 = issue.getCustomFieldValue(myCustomField1).toString()

def concatValue = "Objednávka" + " " + value1


1 answer

1 accepted

0 votes
Answer accepted
Mohamed Benziane
Community Leader
Community Leader
Community Leaders are connectors, ambassadors, and mentors. On the online community, they serve as thought leaders, product experts, and moderators.
Aug 05, 2022 • edited Aug 22, 2022


when you get the value from a cascading field Jira will return a Hashmap you can confirm it like that

def value1 = issue.getCustomFieldValue(myCustomField1)

log.warn(value1.getClass())//will return ==> class java.util.HashMap

Then we just need to know how to access to the value inside the hashmap, you will need to know the key (i assume Jira will not change the key everytime i want to access it)

so i just need to log the value i get like that

log.warn(value1)//return [null:Test, 1:test]

Then to access my first value i can do this

def firstValue = value1.get(null)
def secondValue = value.get("1")// the key are string

Hello Mohamed. 

Thank you for your advice. I was not able to make it running but I got help from someone else. We made it running with ScriptRunner Behaviours. 

The code for the solution: 


def LOV = getFieldByName("Typ objednávky a předmětu")
def sum = getFieldById("summary").setReadOnly(true)
def selectedOption = LOV.getValue() as String
def result = selectedOption.minus("[").minus("]")

sum.setFormValue("Žádost o nákup: ${result}")
Maybe it will help somebody. 

Suggest an answer

Log in or Sign up to answer
AUG Leaders

Atlassian Community Events