How do I add a custom label type field to JIRA's issue create/edit/view screens?

I have a field called Execution Status, it is a label field with three options, Pass Fail and Error. I cannot figure out how to add the field to JIRA’s issue pages programmatically. I followed the tutorial and found out how to add a custom field which can be added by the JIRA admin, but I want to put a new field on existing issue pages automatically when my plugin is downloaded.

Here is my xml (view edit are same template because nothing is appearing on screen and I just wanted to test it):

<customfield-type key="Execution-Status-field" name="Execution Status" class="com.seguira.jira.plugin.ta.action.ExecutionStatusField"><description>Seguira Test Execution Field</description> 
<resource type="velocity" name="view" location="templates/actions/view-basictext.vm"/>
<resource type="velocity" name="edit" location="templates/actions/view-basictext.vm"/>
<resource type="velocity" name="xml" location="templates/actions/xml-basictext.vm"/>

public class ExecutionStatusField extends LabelsCFType { 

public ExecutionStatusField(JiraAuthenticationContext jac, IssueManager im, GenericConfigManager gcm, LabelUtil lu, LabelManager lm, ProjectImportLabelFieldParser pilfp, JiraBaseUrls jbu) {
super(jac, im, gcm, lu, lm, pilfp, jbu);


I found this code online, and added some to it:

FieldScreenManager fieldScreenManager = ComponentAccessor.getFieldScreenManager();

FieldScreen screen = fieldScreenManager.getFieldScreen(new Long(10001));
FieldScreenTab defaultTab = screen.getTab(0);

I’m unsure where to get the custom field’s ID

and the vm file:

class="multi-select long-field hidden edit-labels-inline multi-select-select" 
name="$" value="Pass" id="$"
multiple="multiple" >

Thanks in advance!

1 Like


If you use the REST API point to create the custom field you will get a response with the custom field ID:

Alternatively, you can get a list of all fields (which includes the IDs) using the following REST API point

I hope this helps.


1 Like

ah ok I will give this a shot. Is creating custom fields through extending labelsCFType outdated?

And if I use the latter API call, to get all fields, will I find my field after the constructor code above?

1 Like