Setting the description of a custom field using the Jira API doesn't actually reflect the new value on the UI until Jira is restarted.
{code}
ComponentAccessor.getCustomFieldManager().getCustomFieldObjectByName("Field Name").setDescription("This is description of field");
{code}
I use this Groovy script (using Script Runner) to update the field description for all field configs. Maybe this is helpful for you.
import com.atlassian.jira.component.ComponentAccessor import com.atlassian.jira.exception.DataAccessException import com.atlassian.jira.issue.CustomFieldManager import com.atlassian.jira.issue.fields.CustomField import com.atlassian.jira.issue.fields.layout.field.* cfName = 'My Customfield' cfDesc = '' FieldLayoutManager fieldLayoutManager = ComponentAccessor.getFieldLayoutManager() CustomFieldManager customFieldManager = ComponentAccessor.getCustomFieldManager() // get all existing FieldLayouts List<FieldLayoutScheme> fieldLayoutSchemes = fieldLayoutManager.getFieldLayoutSchemes() List<Long> fieldLayoutIds = [] fieldLayoutSchemes.each{ fieldLayoutScheme -> Collection<FieldLayoutSchemeEntity> fieldLayoutSchemeEntities = fieldLayoutScheme.getEntities() fieldLayoutSchemeEntities.each{ fieldLayoutSchemeEntitiy -> fieldLayoutIds << fieldLayoutSchemeEntitiy.getFieldLayoutId() } } fieldLayoutIds = fieldLayoutIds.unique() List<FieldLayout> fieldLayouts = fieldLayoutIds.collect{Long fieldLayoutId -> fieldLayoutManager.getFieldLayout(fieldLayoutId as Long)} // get custom field CustomField cfObj = customFieldManager.getCustomFieldObjectByName(cfName) // change description fieldLayouts.each{fieldLayout -> FieldLayoutItem fieldLayoutItem = fieldLayout.getFieldLayoutItem(cfObj) if (fieldLayoutItem) { try { if (!fieldLayout.isDefault()) { efl = fieldLayoutManager.getEditableFieldLayout(fieldLayoutItem.getFieldLayout().getId()) efl.setDescription(fieldLayoutItem, cfDesc) fieldLayoutManager.storeEditableFieldLayout(efl) } else { efdl = fieldLayoutManager.getEditableDefaultFieldLayout() efdl.setDescription(fieldLayoutItem, cfDesc) fieldLayoutManager.storeEditableDefaultFieldLayout(efdl) } } catch (DataAccessException e) { log.error "$e" } } } fieldLayoutManager.refresh()
no, it doesnt work,
someone pls help.
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
For the custom field descriptions displayed in an issue the FieldLayoutManager stores the description. The description isn't automatically updated in the field layouts. Try
ComponentAccessor.getFieldLayoutManager().refresh()
after updating the description.
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
no, it doesnt work,
someone pls help.
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
Try this-
String customFieldOldValue = customField.getValue(currentIssue);
ModifiedValue modifiedValue = new ModifiedValue(customFieldOldValue, newValue);
customField.updateValue(customFieldLayoutItem, currentIssue, modifiedValue, issueChangeHolder);
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
But you are talking about setting customfield value.
And am talking about setting customfield description not value.
Please read my question carefully.
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
Join us to learn how your team can stay fully engaged in meetings without worrying about writing everything down. Dive into Loom's newest feature, Loom AI for meetings, which automatically takes notes and tracks action items.
Register today!Online forums and learning are now in one easy-to-use experience.
By continuing, you accept the updated Community Terms of Use and acknowledge the Privacy Policy. Your public name, photo, and achievements may be publicly visible and available in search engines.
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.