Standard JIRA Fields

This page explains how to access the value of Standard Jira fields using Nunjucks. Each field's structure is explained with examples. To understand how to write values into these fields see, Text input for fields and JSON input for fields.

It is now possible to access the standard fields of an issue by its Field name or Key.

Example:

{{ issue.fields.watches.watchCount }} and {{ issue.fields.Watchers.watchCount }}, both return the number of watchers.

When the field name contains a space or any special character, you need to use the array syntax to access the field :

Example:

{{ issue.fields['Issue Type'].name }}

{{ issue.fields['Component/s'][0].name }}

 

Affects Version/s

  • Field name : Affects Version/s

  • Key: versions

  • Description : The Affects Version/s field is an array of objects. Each object represents a single version.

  • Structure :

     Click here to see the structure of Affect Version/s
    Structure
    "issue":
    {
    	...
    	...
    	"fields":
    	{
    		....
    		....
    		"versions": 
    		[
    			{
    				"self":String, //URL of the versions
    				"id":String, //ID of the version
    				"description": String, //Description of the version
    				"name":String, //Name of the version
    				"archived":Boolean, //True when archived
    				"released":Boolean, //True when released
    				"releaseDate":String //Release date of the version
    			},
    			{
    				//Second version and so on.
    			}
    			...
    		],
    		...
    	}
    }
    Example
    "issue":
    {
    	...
    	...
    	"fields":
    	{
    		....
    		....
    		"versions": 
    		[
    			{
    				"self":"https://jmwe-test-2.atlassian.net/rest/api/2/version/10601",
    				"id":"10601",
    				"description":"Trial Version",
    				"name":"2",
    				"archived":false,
    				"released":true,
    				"releaseDate":"2016-10-06"
    			},
    			{
    					...
    			}
    		...
    		],
    	}
    }

  • Accessing the Affects version/s field

    • First Affects Version name : {{issue.fields.versions[0].name}}

    • Last Affects Version name:

      {{ issue.fields.versions | last | field("name")}}

      where '|' is the pipe operator, 'last' and 'field' are filters. See Nunjucks annotations for more filters.

    • Join the names of the Affects Version/s, separated by commas: {{issue.fields.versions | join("," , "name")}}

    • Return all the Affects Version/s, in a format that can be used to set the Fix Version/s field : {{issue.fields.versions | dump(2)}}

    • Test whether "1.0" is in the Affects Version/s: {{ issue.fields.versions | find({name:"1.0"}) }}

 

Assignee

  • Field name : Assignee

  • Key: assignee

  • Description : The Assignee field is an object that represents the user who this issue is assigned to.

  • Structure :

     Click here to see the structure of Assignee field
    Structure
    "issue":
    {
    	...
    	...
    	"fields":
    	{
    		....
    		....
    		"assignee": 
    		{
    			"self":String, //URL of the user
    			"accountId": String,
    			"emailAddress":String, //Email ID of the user
    			"avatarUrls": //URLs of assignee avatar
    			{
    				"48x48":String,
    				"24x24":String,
    				"16x16":String,
    				"32x32":String,
    			},
    			"displayName":String, //Display name of the user
    			"active":Boolean, //True when the user is active
    			"timeZone":String, //Time zone of the user
    			"accountType": String //Account type 
    		},
    	}
    }
    Example
    "issue":
    {
    	...
    	...
    	"fields":
    	{
    		....
    		....
    		"assignee":
    		{
    			"self": "https://validationenvironment.atlassian.net/rest/api/2/user?accountId=5ca5b1469a000c1180956957",
    			"accountId": "accountId:5ca5b1469a000c1180956957",
    			"emailAddress":"rvijji@innovalog.com",
    			"avatarUrls":
    			{
    				"48x48":"https://jmwe-test-2.atlassian.net/secure/useravatar?avatarId=10337",
    				"24x24":"https://jmwe-test-2.atlassian.net/secure/useravatar?size=small&avatarId=10337",
    				"16x16":"https://jmwe-test-2.atlassian.net/secure/useravatar?size=xsmall&avatarId=10337",
    				"32x32":"https://jmwe-test-2.atlassian.net/secure/useravatar?size=medium&avatarId=10337"
    			},
    			"displayName":"Radhika Vijji",
    			"active":true,
    			"timeZone":"Europe/Berlin",
    			"accountType": "atlassian"
    		},
    	}
    }

  • Accessing the Assignee field

    • AccountId of the Assignee : {{issue.fields.assignee.accountId}}

    • Timezone of the assignee : {{issue.fields.assignee.timeZone}}

 

Attachments

  • Field name : Attachment

  • Key: attachment

  • Description : Attachment is an array of objects. Each object represents a single attachment.

  • Structure :

     Click here to see the structure of Attachments
    Structure
    "issue":
    {
    	...
    	...
    	"fields":
    	{
    		....
    		....
    		"attachment": 
            [
                {
                    "self":String, //URL of the attachment
                    "id":String, //ID of the attachment
                    "filename":String, //Name of the attachment
                    "author": //Author of the attachment
                    {
    		            "self":String, //URL of the author
    					"accountId": String,
         				"emailAddress":String, //Email ID of the author
          				"avatarUrls":
    				     {
               				"48x48":String, //URL of the author
                			"24x24":String, //URL of the author
                			"16x16":String, //URL of the author
                			"32x32":String, //URL of the author
            			},
            			"displayName":String, //Display name of the author
            			"active":Boolean, //True when the author is active
            			"timeZone":String, //Time zone of the author
    					"accountType": String //Account type 
                    },
                    "created":String, //Attachment created timestamp
                    "size":Number, //Size of the attachment
                    "mimeType":String, //Type of the attachment
                    "content":String, //Content of the attachment
                    "thumbnail":String //Thumbnail of the attachment
                },
            ],
    		...
    	}
    	...
    }
    Example
    "issue":
    {
    	...
    	...
    	"fields":
    	{
    		....
    		....
    		"attachment":
    		[
    			{
    				"self":"https://jmwe-test-2.atlassian.net/rest/api/2/attachment/11001","id":"11001",
    				"filename":"one.png",
    				"author":
    				{
    					"self": "https://validationenvironment.atlassian.net/rest/api/2/user?accountId=5ca5b1469a000c1180956957",
    					"accountId": String,
    					"emailAddress":"rvijji@innovalog.com",
    					"avatarUrls":
    					{
    						"48x48":"https://jmwe-test-2.atlassian.net/secure/useravatar?avatarId=10337",
    						"24x24":"https://jmwe-test-2.atlassian.net/secure/useravatar?size=small&avatarId=10337",
    						"16x16":"https://jmwe-test-2.atlassian.net/secure/useravatar?size=xsmall&avatarId=10337",
    						"32x32":"https://jmwe-test-2.atlassian.net/secure/useravatar?size=medium&avatarId=10337"
    					},
    					"displayName":"Radhika Vijji",
    					"active":true,
    					"timeZone":"Europe/Berlin",
    					"accountType": String //Account type 
    					
    				},
    				"created":"2016-10-13T12:33:50.472+0200",
    				"size":31721,
    				"mimeType":"image/png",
    				"content":"https://jmwe-test-2.atlassian.net/secure/attachment/11001/one.png",
    				"thumbnail":"https://jmwe-test-2.atlassian.net/secure/thumbnail/11001/_thumb_11001.png"
    			}
    			{
    				//Second attachment and so on..
    				}
    		],
    		...
    	}
    	...
    }

  • Accessing the Attachment field

    • Size of the last attachment :

      {{ issue.fields.attachment | last | field("size")%}

      where '|' is the pipe operator, 'last' and 'field' are filters. See Nunjucks annotations for more filters.

    • Name of the Author of the first attachment : {{ issue.fields.attachment[0].author.accountId}}

 

Created

  • Field name : Created

  • Key: created

  • Description : The Created field is a string representation of a date.

  • Structure :

     Click here to see the structure of the Created field
    Structure
    "issue":
    {
    	...
    	...
    	"fields":
    	{
    		...
    		...
    		"created":String, //Created datetime stamp
    		...
    	}
    	...
    }
    Example
    "issue":
    {
    	...
    	...
    	"fields":
    	{
    		...
    		...
    		"created":"2016-10-13T08:10:16.644+0200",
    		...	
    	}
    	...
    }

  • Accessing the Created fields

    • Created date of the issue : {{ issue.fields.created }}

    • Format the created date : {{ issue.fields.created | date('fromNow') }}

You can use the date filter to manipulate and/or format the value

 

Creator

  • Field name : Creator

  • Key: creator

  • Description : The Creator field is an object that represents the user who created this issue.

  • Structure :

     Click here to see the structure of Creator field
    Structure
    "issue":
    {
    	...
    	...
    	"fields":
    	{
    		....
    		....
    		"assignee": 
    		{
    			"self":String, //URL of the user
    			"accountId": String,
    			"emailAddress":String, //Email ID of the user
    			"avatarUrls": //URLs of assignee avatar
    			{
    				"48x48":String,
    				"24x24":String,
    				"16x16":String,
    				"32x32":String,
    			},
    			"displayName":String, //Display name of the user
    			"active":Boolean, //True when the user is active
    			"timeZone":String, //Time zone of the user
    			"accountType": String
    		},
    	}
    }
    Example
    "issue":
    {
    	...
    	...
    	"fields":
    	{
    		....
    		....
    		"assignee":
    		{
    			"self":"https://jmwe-test-2.atlassian.net/rest/api/2/user?username=rvijji",
    			"accountId": "accountId:5ca5b1469a000c1180956957",
    			"emailAddress":"rvijji@innovalog.com",
    			"avatarUrls":
    			{
    				"48x48":"https://jmwe-test-2.atlassian.net/secure/useravatar?avatarId=10337",
    				"24x24":"https://jmwe-test-2.atlassian.net/secure/useravatar?size=small&avatarId=10337",
    				"16x16":"https://jmwe-test-2.atlassian.net/secure/useravatar?size=xsmall&avatarId=10337",
    				"32x32":"https://jmwe-test-2.atlassian.net/secure/useravatar?size=medium&avatarId=10337"
    			},
    			"displayName":"Radhika Vijji",
    			"active":true,
    			"timeZone":"Europe/Berlin",
    			"accountType": "atlassian"
    		},
    	}
    }

  • Accessing the Creator field

    • Name of the Creator of the issue : {{ issue.fields.creator.accountId }}

    • Display name of the creator : {{ issue.fields.creator.displayName }}

 

Comments

  • Field name : Comment

  • Key: comment

  • Description : The Comments field is an object with two fields:

    • comments, containing an array of objects. Each object represents a single comment.

    • total, showing the number of comments

  • Structure :

     Click here to see the structure of Comments
    Structure
    "issue":
    {
    	...
    	...
    	"fields":
    	{
    		....
    		....
    		"comment":
    		{
    			"comments":
    			[
    				{
    					"self":String, //URL of the first comment
                        "id":String, //ID of the first comment
                        "author": //The "Author" field is an object with the following fields
    					{
    						"self":String, //URL of the author
           					"accountId": String,
         				   	"emailAddress":String, //Email ID of the author
          				  	"avatarUrls":
    				        {
               					"48x48":String, //URL of the author
                				"24x24":String, //URL of the author
                				"16x16":String, //URL of the author
                				"32x32":String, //URL of the author
            				},
            				"displayName":String, //Display name of the author
            				"active":Boolean, //True when the author is active
            				"timeZone":String, //Time zone of the author
    						"accountType": String //Account type
    					},
    					"body":"1",
    					"updateAuthor":
    					{
    						"self":String, //URL of the update author
           					"accountId": String, //AccountId of the author
         				   	"emailAddress":String, //Email ID of the update author
          				  	"avatarUrls":
    				        {
               					"48x48":String, //URL of the update author
                				"24x24":String, //URL of the update author
                				"16x16":String, //URL of the update author
                				"32x32":String, //URL of the update author
            				},
            				"displayName":String, //Display name of the update author
            				"active":Boolean, //True when the update authoris active
            				"timeZone":String, //Time zone of the update author
    						"accountType": String //Account type						
    					},
    					"created":String, //Time stamp when the comment is created
                        "updated":String, //Time stamp when the comment is updated
    				},
    				{
    					//Second comment and so on..
    				}
    			],
    			 "maxResults":Number, //Total number of comments
                "total":Number, //Total number of comments
                "startAt":Number //Number at which the comments started.
    		},
    		...
    	}
    	...
    }
    Example
    "issue":
    {
    	...
    	...
    	"fields":
    	{
    		....
    		....
    		"comment":
    		{
    			"comments":
    			[
    				{
    					"self":"https://jmwe-test-2.atlassian.net/rest/api/2/issue/30102/comment/27600",
    					"id":"27600",
    					"author":
    					{
    						"self": "https://validationenvironment.atlassian.net/rest/api/2/user?accountId=5ca5b1469a000c1180956957",
    						"accountId": "accountId:5ca5b1469a000c1180956957",
    						"emailAddress":"rvijji@innovalog.com",
    						"avatarUrls":
    						{
    							"48x48":"https://jmwe-test-2.atlassian.net/secure/useravatar?avatarId=10337",
    							"24x24":"https://jmwe-test-2.atlassian.net/secure/useravatar?size=small&avatarId=10337",
    							"16x16":"https://jmwe-test-2.atlassian.net/secure/useravatar?size=xsmall&avatarId=10337",
    							"32x32":"https://jmwe-test-2.atlassian.net/secure/useravatar?size=medium&avatarId=10337"
    						},
    						"displayName":"Radhika Vijji",
    						"active":true,
    						"timeZone":"Europe/Berlin",
    						"accountType": "atlassian"
    					},
    					"body":"1",
    					"updateAuthor":
    					{
    						"self": "https://validationenvironment.atlassian.net/rest/api/2/user?accountId=5ca5b1469a000c1180956957",
    						"accountId": "accountId:5ca5b1469a000c1180956957",
    						"emailAddress":"rvijji@innovalog.com",
    						"avatarUrls":
    						{
    							"48x48":"https://jmwe-test-2.atlassian.net/secure/useravatar?avatarId=10337",
    							"24x24":"https://jmwe-test-2.atlassian.net/secure/useravatar?size=small&avatarId=10337",
    							"16x16":"https://jmwe-test-2.atlassian.net/secure/useravatar?size=xsmall&avatarId=10337",
    							"32x32":"https://jmwe-test-2.atlassian.net/secure/useravatar?size=medium&avatarId=10337"
    						},
    						"displayName":"Radhika Vijji",
    						"active":true,
    						"timeZone":"Europe/Berlin",
    						"accountType": "atlassian"
    					},
    					"created":"2016-10-13T12:02:41.802+0200",
    					"updated":"2016-10-13T12:02:41.802+0200"
    				},
    				{
    					//Second comment and so on..
    				}
    			],
    			"maxResults":2,
    			"total":2,
    			"startAt":0
    		},
    		...
    	}
    	...
    }

  • Accessing the Comments field

    • Number of comments on the issue : {{issue.fields.comment.total}}

    • Last Comment body :

      {{ issue.fields.comment.comments | last | field("body") }}

      where '|' is the pipe operator, 'last' and 'field' are filters. See Nunjucks annotations for more filters.

    • AccountId of the author of the first comment on the issue :

      {{ issue.fields.comment.comments | first | field("author.accountId") }}

      where '|' is the pipe operator, 'first' and 'field' are filters. See Nunjucks annotations for more filters.

    • Email address of the author of the last comment on the issue :

      {{ issue.fields.comment.comments | last | field("author.emailAddress") }}

      where '|' is the pipe operator, 'last' and 'field' are filters. See Nunjucks annotations for more filters.

    • Display all the comments in a text field : {{ issue.fields.comment.comments | join("\n" , "body") }}

 

Component/s

  • Field name : Component/s

  • Key: components

  • Description : The Components field is an array of objects. Each object represents one component.

  • Structure :

     Click here to see the structure of Components field
    Structure
    "issue":
    {
    	...
    	...
    	"fields":
    	{
    		....
    		....
    		"components":
    		[
    			{
    				"self": String, //URL of the component
    				"id":String, //ID of the component
    				"name": String, //Name of the component
    				"description":String //Description of the component
    			},
    			{
    				//Second component and so on..
    			}
    		]
    	}
    }
    Example
    "issue":
    {
    	...
    	...
    	"fields":
    	{
    		....
    		....
    		"components":
    		[
    			{
    				"self":"https://jmwe-test-2.atlassian.net/rest/api/2/component/10500",
    				"id":"10500",
    				"name":"C1",
    				"description":"C1 set"
    			},
    			{
    				//Second component and so on..
    			}
    		]
    	}
    }

  • Accessing the Components field

    • First component name : {{issue.fields.components[0].name}}

    • Last component description :

      {{ issue.fields.components | last | field("description") }}

      where '|' is the pipe operator, 'last' and 'field' are filters. See Nunjucks annotations for more filters.

    • All components of the current issue:

      {{issue.fields.components | join ("," , "name") }}

    • Test whether "UI" is in the Components: {{ issue.fields.components | find({name:"UI"}) }}

 

Description

  • Field name : Description

  • Key: description

  • Description : The Description field is a string representation of a multi-line text describing the issue.

  • Structure :

     Click here to see the structure of Description field
    Structure
    "issue":
    {
    	...
    	...
    	"fields":
    	{
    		...
    		...
    		"description": String, //Description of the issue
    		...
    	}
    	...
    }
    Example
    "issue":
    {
    	...
    	...
    	"fields":
    	{
    		...
    		...
    		"description": "New test",
    		...
    	}
    	...
    }

  • Accessing the Description field

    • Description of the issue : {{issue.fields.description}}