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 needs to be manipulated, be it on a listener, 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.
The following are the 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 theComponentManager
class. It can be done as follows:CustomFieldManager customFieldManager = ComponentManager...