Script for choosing a value for a custom defined field

Hi everybody, 

as it is not possible to display custom defined fields if they have no value I did the following for a text area: at the first workflow transation I run the script mentioned below to set the value ' - '. So the field has an value and ist shown, it works fine. But now  I have the same problem for a select box - but unfortunately the script doesn't work.

 

import com.atlassian.jira.component.ComponentAccessor
import com.atlassian.jira.issue.MutableIssue
import com.atlassian.jira.issue.util.DefaultIssueChangeHolder
import com.atlassian.jira.issue.ModifiedValue
 
def customFieldManager = ComponentAccessor.getCustomFieldManager();
def category = customFieldManager.getCustomFieldObjects(issue).find {it.name == 'Kategorie'};
 
def changeHolder = new DefaultIssueChangeHolder();
category.updateValue(null, issue, new ModifiedValue(issue.getCustomFieldValue(category), 'bitte wählen'), changeHolder);
 
issue.store();

 What is my fault? Or has anybody an idea what to do to display custoim defined fields without values?

Thanks a lot in advance!

 

1 answer

This widget could not be displayed.

You'll need an option! I'll point people to Hennings answer (please give him a vote):

https://answers.atlassian.com/questions/259390

Suggest an answer

Log in or Sign up to answer
Atlassian Summit 2018

Meet the community IRL

Atlassian Summit is an excellent opportunity for in-person support, training, and networking.

Learn more
Community showcase
Posted Wednesday in New to Jira

Are you planning to trial, or are currently trialling Jira Software? - We want to talk to you!

Hello! I'm Rayen, a product manager at Atlassian. My team and I are working hard to improve the trial experience for Jira Software Cloud. We are interested in   talking to 20 people planning t...

207 views 3 0
Join discussion

Atlassian User Groups

Connect with like-minded Atlassian users at free events near you!

Find a group

Connect with like-minded Atlassian users at free events near you!

Find my local user group

Unfortunately there are no AUG chapters near you at the moment.

Start an AUG

You're one step closer to meeting fellow Atlassian users at your local meet up. Learn more about AUGs

Groups near you