Or we can write it this way,
In this case, it is also possible that this field is accidentally deleted and re created; Then its ID value will also change. You still need to find all the scripts in the system that use this code to modify its value.
Or in the following cases, the ID value or name is inconsistent in our production environment or test environment, which will also lead to the script debugged in the test environment, and the script obtained from the production environment can only be run by changing this value one by one.
For the above scenarios, using this plug-in, we can define a fixed variable in it. The value of this variable can be quickly managed visually. After modifying this value, all the changes in the system will take effect, which makes it convenient for us to manage these variables in a unified way, so as to achieve visual and global management of variable scripts used everywhere in our system.
In order to manage global parameters and facilitate the maintenance of managers, for example, if an administrator needs to write multiple parameters for interfacing with a third-party system, he can group by these parameters;
Therefore, the global grouping will be distinguished by prefix in this app; When managing parameters, you first need to determine which prefix for them .
Prefix information is a definition of grouping global parameters, so prefix management is required.
You can navigate to the prefix information to add and manage prefixes. After saving, the prefix information defined in the system will be displayed.
Key-value is effective information provided for business use. It is allowed to add a key value pair to the corresponding prefix to obtain information through full key in the system.
You can select the prefix defined in the system to query all key value pairs included in this prefix. Of course, you can also modify a key value pair.
If you need to add a new key value pair to a prefix, you can add one. At this time, click "add" to pop up the add interface
When the key value pair is defined and newly added, its information can be obtained where needed for business processing.
Yes, you can use this kind of com.atlassian.jira.config.properties. Applicationproperties and use its getText() method.
Get all key-values information for a prefix
Get a value for a specific full key
- REST URL
First, we define a variable value by this app（ prefix is：SCRITRUNNER，KEY is ：DEV_OWNER） then its fullkey is：HKTXPROPERTIESKEY.SCRITRUNNER.DEV_OWNER , value is：123456
Your code may be like this
String devOwnerCustomfieldId = applicationProperties.getString("HKTXPROPERTIESKEY.SCRITRUNNER.DEV_OWNER") ;
CustomField devOwnerCustomfield = customFieldManager.getCustomFieldObject(Long.parseLong(devOwnerCustomfieldId));
ApplicationUser devOwnerUser = issue.getCustomFieldValue(devOwnerCustomfield);