Dealing with custom fields on an issue
In this recipe, we will see how to work with custom fields on an issue. It covers reading a custom field value from an issue and then updating the custom field value on the issue, with and without notifications.
Getting ready
Identify the places where the custom fields need to be manipulated, be it on a listener, a workflow element, or somewhere else in our plugins.
How to do it…
We will see how to access the value of a custom field, and modify the value as we go along. Complete the following steps to read the custom field value from an Issue
object:
Create an instance of the
CustomFieldManager
class. This is the Manager class that does most of the operations on custom fields. There are two ways to retrieve a Manager class:Inject the Manager class in the constructor of your plugin class implementation.
Retrieve the
CustomFieldManager
directly from theComponentAccessor
class. It can be done as follows:CustomFieldManager customFieldManager = ComponentAccessor...