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!


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
Community Members
Community Events
Community Groups

Use Asset fields in script

Anna Smirnova
I'm New Here
I'm New Here
Those new to the Atlassian Community have posted less than three times. Give them a warm welcome!
May 03, 2023

I have requirement, if the field have specific value, I have to show or hide other fields on JSM portal. And it works perfectly with usual fields and easy behaviour:

def projectCategory = getFieldByName("Category")
def otherProjectCategory = getFieldByName("Category Name")

def selectedOption = projectCategory.getValue() as String
log.debug "Selected option: $selectedOption"

if (selectedOption == "Other" ) {

else {

But now instead of usual custom field “Category” I need to use Asset field “Category”. But then script is not working.

Is there any way to do it?

1 answer

0 votes
Peter-Dave Sheehan
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 03, 2023

The behavior getValue() method on Insight Custom fields, will return the Object's Key (as String), not the label or name of the object.

Also, it might return a single string or an array of strings depending on a few factors.

  • Whether you are in a regular jira screen or portal screen
  • Whether the field allows a single value or multiple

In the portal,  single fields will always return a single string value and multiple fields will always return an array - even an empty field will return an empty array.

In Jira, single fields always return a single string value. Multiple fields will return a string value if the field is empty or contain a single value and they'll return an array when you have more than one value selected.

You can place a simple script on that field to see for yourself what condition returns what

def formField = getFieldById(fieldChanged)
def val = formField.value
formField.setHelpText("$val ${val.getClass()}")

So in terms of your script logic, you either need to lookup the object key that matches "Other" and put that key in your script.

Or deal with the complex insight java api to load the object that match the selected key and read some attribute to base your logic on.

Suggest an answer

Log in or Sign up to answer
AUG Leaders

Atlassian Community Events