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

Hi All,

I am trying to develop a plugin which takes field and field config and new description as input from user and changes the description of the field. 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());

Answer