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,360,149
Community Members
 
Community Events
168
Community Groups

How to change description of a field for a particular field configurations using groovy?

Hi All,

How to change the description of a field for a particular field configuration using groovy?

I have written the below script. It is not throwing any errors and it's not changing the description too. 

Code:

import com.atlassian.jira.component.ComponentAccessor
import com.atlassian.jira.issue.Issue
import com.atlassian.jira.issue.fields.layout.field.FieldLayoutManager
import com.atlassian.jira.issue.fields.layout.field.FieldConfigurationScheme
import org.apache.log4j.Logger
import org.apache.log4j.Level
import com.atlassian.jira.issue.fields.layout.field.FieldLayoutItemImpl.Builder

 

def log = Logger.getLogger("test.connector")
log.setLevel(Level.DEBUG)


FieldLayoutManager fieldLayoutManager = ComponentAccessor.getComponent(FieldLayoutManager);
def scheme = fieldLayoutManager.getEditableDefaultFieldLayout();
def field = scheme.getFieldLayoutItem("customfield_10000");
scheme.setDescription(field,"new desc");
log.debug(scheme.getName());

1 answer

0 votes

Hello @Kiran Jonnada

To change field description via groovy you should use customFieldManger, like this

import com.atlassian.jira.component.ComponentAccessor

def customFieldManager = ComponentAccessor.getCustomFieldManager()
def customField = customFieldManager.getCustomFieldObjectByName("CustomField name")
customFieldManager.updateCustomField(customField.getIdAsLong(), customField.getName(), "Some test description", customField.getCustomFieldSearcher())

Hello @Kiran Jonnada , I have the same problem to resolve, some 40 custom fields in multiple field configurations. Can you please let me know if you have solved your problem and the approach?

 

If I follow Mark Markov's note, only default field configuration is changed.

 

Thank you 

with warm regards

ramki 

The original post is about the field description in a field configuration. The first reply was about changing the custom field description, which is related but different

And I think that you can't modify the default field configuration in groovy?

Suggest an answer

Log in or Sign up to answer
TAGS
Community showcase
Published in Jira

Online AMA this week: Your project management questions answered by Jira Design Lead James Rotanson

We know that great teams require amazing project management chops. It's no surprise that great teams who use Jira have strong project managers, effective workflows, and secrets that bring planning ...

184 views 1 6
Read article

Atlassian Community Events