Our new Appfire Documentation Space is now live!

Take a look here! If you have any questions please email support@appfire.com

Skip to end of metadata
Go to start of metadata

You are viewing an old version of this page. View the current version.

Compare with Current View Page History

« Previous Version 42 Next »

This page explains how to access the value of User-created custom fields of different field types using Nunjucks. Each field's structure is explained, with examples. To understand how to write values into these fields see String value - User-created custom fields and JSON value - User-created custom fields.

It is now possible to access any user-created custom field of an issue by its Field name or ID. Click here to know how to find the ID of custom fields.

Example:

{{ issue.fields.Projectpicker.name }} and {{ issue.fields.customfield_10302.name }}, both return the name of the selected Project.

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['Multi user picker'][0].displayName }}


In this page: 


Select list

Checkboxes / Multi-select list

  • Description: A field of the type Checkboxes/Multi-select list, is an array of objects. Each object represents an option of the checkbox/select list.

  • Structure:

     Click here to see the structure of a field of Checkbox/Multi-select list type
    Structure
    "issue":
    {
    	...
    	...
    	"fields":
    	{
    		...
    		...
    		{
        		"self":String, //URL of the choice
        		"value":String, //Value of the choice
        		"id":String //ID of the choice
    		},
    		...
    	}
    	...
    }
    Example
    "issue":
    {
    	...
    	...
    	"fields":
    	{
    		...
    		...
    		"customfield_10200":
    		[
    			{
    				"self":"https://jmwe-test-2.atlassian.net/rest/api/2/customFieldOption/10100",
    				"value":"Option1",
    				"id":"10100"
    			},
    			{
    				//Second option and so on..
    			}
    		],
    		...
    	}
    	...
    }
  • Accessing a field of Checkboxes/Multi-select list type
    • The value of the last option:

      {{ issue.fields['Multi-select field'] | last | field("value") }}
    • Display the values of all selected options, separated by a comma: {{ issue.fields['Checkboxes field'] | join("," , "value") }}

Radio buttons / Single select list

  • Description: A field of Radio buttons/Single select list type is an object describing the selected option.

  • Structure:

     Click here to see the structure of a field of Radio buttons/Single select list type
    Structure
    "issue":
    {
    	...
    	...
    	"fields":
    	{
    		...
    		...
    		"customfield_xxxx":
    		{
        		"self":String, //URL of the choice
       			 "value":String, //Value of the choice
       			 "id":String //ID of the choice
    		},
    		...
    	}
    	...
    }
    Example
    "issue":
    {
    	...
    	...
    	"fields":
    	{
    		...
    		...
    		"customfield_10203":
    		{
    			"self":"https://jmwe-test-2.atlassian.net/rest/api/2/customFieldOption/10103",
    			"value":"Option2",
    			"id":"10103"
    		},
    		...
    	}
    	...
    }
  • Accessing a field of Radio buttons/Single select list type
    • The value of the option: {{ issue.fields['Single select field'].value }}

Cascading

  • Description: A field of Cascading type is an object representing parent of the cascading with one field:

    • child, an object representing the child of the parent.
  • Structure:

     Click here to see the structure of a field of Cascading type
    Structure
    "issue":
    {
    	...
    	...
    	"fields":
    	{
    		...
    		...
    		"customfield_xxxxx":
    		{
                "self":String, //URL of the parent of the cascading custom field.
                "value":String, //Value of the parent of the cascading custom field.
                "id":String, //ID of the custom field.
                "child":
                    {
                        "self":String, //URL of the child of the cascading custom field.
                        "value":String, //Value of the child of the cascading custom field.
                        "id":String //ID of the child of the cascading custom field.
                    }
            },
    		...
    	}
    	...
    }
    Example
    "issue":
    {
    	...
    	...
    	"fields":
    	{
    		....
    		....
    		"customfield_10403":
    		{
    			"self":"https://jmwe-test-2.atlassian.net/rest/api/2/customFieldOption/10212",
    			"value":"1",
    			"id":"10212",
    			"child":
    			{
    				"self":"https://jmwe-test-2.atlassian.net/rest/api/2/customFieldOption/10215",
    				"value":"1.2",
    				"id":"10215"
    			}
    		},
    	...
    	}
    }
  • Accessing a field of Cascading type
    • The value of the parent of the cascading field: {{ issue.fields["Cascading field"] }}

    • The value of the child of the cascading field: {{ issue.fields["Cascading field"] | field("child.value) }}
    • Display the parent and child of the cascading field values separated by a comma:

      {{ issue.fields['Cascading field'].value }},{{ issue.fields['Cascading field'] | field("child.value") }}

Groups

Single Group Picker

  • Description: A field of Single group picker type is an object that represents the selected group

  • Structure:

     Click here to see the structure of a field of SIngle group picker type
    Structure
    "issue":
    {
    	...
    	...
    	"fields":
    	{
    		....
    		....
    		"customfield_xxxx":
    		{
                "name":String, //Name of the Group.
                "self":String, //URL of the Group.
            },
    
    
    	}
    	...
    }
    Example
    "issue":
    {
    	...
    	...
    	"fields":
    	{
    		...
    		...
    		"customfield_10300":
    		{
    			"name":"administrators",
    			"self":"https://jmwe-test-2.atlassian.net/rest/api/2/group?groupname=administrators"
    		},
    		...
    	}
    	...
    }
  • Accessing a field of Single Group picker type:
    • Name of the group: {{ issue.fields['Single group picker field'].name }}

Multi-Group Picker

  • Description: A field of Multi-group picker type is an array of objects. Each object represents a single group.

  • Structure:

     Click here to see the structure of a field of Multi-group picker type
    Structure
    "issue":
    {
    	...
    	...
    	"fields":
    	{
    		...
    		...
     		"customfield_xxxxx":
            [
                {
                    "name":String, //Name of the first group
                    "self":String //URL of the first group
                },
                {  
                    //Second group and so on.
                }
                ...
            ],
    		...
    	}
    	...
    }
    Example
    "issue":
    {
    	...
    	...
    	"fields":
    	{
    		...
    		...
    		"customfield_10301":
    		[
    			{
    				"name":"administrators",
    				"self":"https://jmwe-test-2.atlassian.net/rest/api/2/group?groupname=administrators"
    			},
    			{
    				//Second group and so on
    			}
    		],
    	...
    	}
    }
  • Accessing a field of Multi-group picker type
    • Name of the first group:

      {{ issue.fields['Multi group picker field'] | first | field("name") }}

Users

Single User picker

  • Description: A field of Single user picker type field is an object that represents the selected user.

  • Structure:

     Click here to see the structure of a field of single user picker type
    Structure
    "issue":
    {
    	...
    	...
    	"fields":
    	{
    		....
    		....
    		"customfield_xxxxx":
    		{
    			"self":String, //URL of the user
           		"name":String, //Name of the user
            	"key":String, //Key of the user
            	"emailAddress":String, //Email ID of the user
            	"avatarUrls":
            	{
                	"48x48":String, //URL of the user
                	"24x24":String, //URL of the user
                	"16x16":String, //URL of the user
                	"32x32":String, //URL of the user
           		},
            	"displayName":String, //Display name of the user
            	"active":Boolean, //True when the user is active
            	"timeZone":String //Time zone of the user
    		},
    		...
    	},
    	...
    }
    Example
    "issue":
    {
    	...
    	...
    	"fields":
    	{
    		....
    		....
    		"customfield_10058":
    		{
    			"self":"https://jmwe-test-2.atlassian.net/rest/api/2/user?username=rvijji",
    			"name":"rvijji",
    			"key":"rvijji",
    			"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"
    		},
    		...
    	},
    	...
    }
  • Accessing a field of Single user picker type
    • Display name of the user: {{ issue.fields['Single user type field'].displayName }}

Multi-user picker

  • Description: A field of Multi-user picker type is an array of objects. Each object represents a single user.

  • Structure:

     Click here to see the structure of a field of Multi -user picker type
    Structure
    "issue":
    {
    	...
    	...
    	"fields":
    	{
    		...
    		...
    		"customfield_xxxxx":
    		[
    			{
    				"self":String, //URL of the user
           			"name":String, //Name of the user
            		"key":String, //Key of the user
            		"emailAddress":String, //Email ID of the user
            		"avatarUrls":
            		{
                		"48x48":String, //URL of the user
                		"24x24":String, //URL of the user
                		"16x16":String, //URL of the user
                		"32x32":String, //URL of the user
    	       		},
        	    	"displayName":String, //Display name of the user
            		"active":Boolean, //True when the user is active
            		"timeZone":String //Time zone of the user
    			},
    			{
    				//Second user and so on.
    			}
    		],
    		...
    	}
    	...
    }
    Example
    "issue":
    {
    	...
    	...
    	"fields":
    	{
    		...
    		...
    		"customfield_10059":
    		[
    			{
    				"self":"https://jmwe-test-2.atlassian.net/rest/api/2/user?username=rvijji",
    				"name":"rvijji",
    				"key":"rvijji",
    				"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"
    			},
    		],
    		...
    	}
    	...
    }



  • Accessing a field of multi-user type
    • Display the users' username separated by a comma: {{ issue.fields['Multi user type field'] | join("," , "name") }}

Versions

Single version picker

  • Description: A field of Single version picker type is an object that represents a single selected version.

  • Structure:

     Click here to see the structure of a field of single version type
    Structure
    "issue":
    {
        ...
        ...
        "fields":
        {
            ...
            ...
            "customfield_xxxxx":
            {
            	"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
            },
    		...
        }
    	...
    }
    Example
    "issue":
    {
        ...
        ...
        "fields":
        {
            ...
            ...
            "customfield_10025":
            {
     			"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 a field of Single Version picker type
    • Name of the version: {{ issue.fields['Single version picker field'].name }}

Multi-version picker

  • Description: A field of Multi version picker type is an array of objects. Each object represents a single version.

  • Structure:

     Click here to see the structure of a field of multi version type
    Structure
    "issue":
    {
        ...
        ...
        "fields":
        {
            ...
            ...
            "customfield_xxxxx":
    		[
    			{
            		"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":
        {
            ...
            ...
            "customfield_10025":
    		[
    		   	{
     				"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"
            	},
    			{
    				//Second version and so on..
    			}
    		],
    		...
        },
    	...
    }
  • Accessing a field of Multi version picker type
    • First version name: {{issue.fields['Multi version picker type field'].name}}

    • Last version name:

      {{ issue.fields['Multi version picker type field'] | last | field("name") }}

      '|' is the pipe operator and 'last' is the filter. See Nunjucks annotations for more filters.

    • Join the names of the version/s, separated by commas: {{issue.fields['Multi version picker type field'] | join("," , "name")}}

Text

Single-line text field type

  • Description: A field of Single line text type is a string representation of a single-line text describing the text field.

  • Structure:

     Click here to see the structure of a field of Single line text type
    Structure
    "issue":
    {
        ...
        ...
        "fields":
        {
            ...
            ...
           "customfield_xxxxx":String,
    		...
        }
    	...
    }
    Example
    "issue":
    {
        ...
        ...
        "fields":
        {
            ...
            ...
            "customfield_10300":"Welcome"
    		...
        },
    	...
    }
  • Accessing a field of Single-line text field type:
    • The text of the field: {{ issue.fields['Single line text field'] }}

Multi-line text field type

  • Description: A field of Multi-line text type is a string representation of a multi-line text describing the read-only text.is a string that represents a multi-line text.

  • Structure:

     Click here to see the structure of a field of Multi-line text type
    Structure
    "issue":
    {
        ...
        ...
        "fields":
        {
            ...
            ...
           "customfield_xxxxx":String,
    		...
        }
    	...
    }
    Example
    "issue":
    {
        ...
        ...
        "fields":
        {
            ...
            ...
            "customfield_10300":"Welcome\nThanks"
    		...
        },
    	...
    }
  • Accessing a field of Multi-line text field type:
    • The text of the field: {{ issue.fields['Multi line text'] }}

Date/Time picker

Date picker type field

  • Description: A field of Date picker type is a String representing the date in ISO_8601 format.

  • Structure:

     Click here to see the structure of a field of Date picker type
    Structure
    "issue":
    {
        ...
        ...
        "fields":
        {
            ...
            ...
           "customfield_xxxxx":String,
    		...
        }
    	...
    }
    Example
    "issue":
    {
        ...
        ...
        "fields":
        {
            ...
            ...
            "customfield_11400":"2017-03-13"
    		...
        },
    	...
    }
  • Accessing a field of Date picker type:
    • The value of the Date picker field:{{ issue.fields['DP'] }}

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


Date time picker type field

  • Description: A field of Date time picker type is a String representing the date in ISO_8601 format.

  • Structure:

     Click here to see the structure of a field of Date time picker type
    Structure
    "issue":
    {
        ...
        ...
        "fields":
        {
            ...
            ...
           "customfield_xxxxx":String,
    		...
        }
    	...
    }
    Example
    "issue":
    {
        ...
        ...
        "fields":
        {
            ...
            ...
            "customfield_11501":"2017-03-31T08:51:00.000+0200"
    		...
        },
    	...
    }
  • Accessing a field of Date picker type:
    • The value of the Date time picker type field:{{ issue.fields['DTP'] }}

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


Others

Numeric field

  • Description: A field of Numeric type is a number.

  • Structure:

     Click here to see the structure of a field of Numeric type
    Structure
    "issue":
    {
        ...
        ...
        "fields":
        {
            ...
            ...
           "customfield_10202": Number,
    		...
        }
    	...
    }
    Example
    "issue":
    {
        ...
        ...
        "fields":
        {
            ...
            ...
            "customfield_10202":50000.0,
    		...
        },
    	...
    }
  • Accessing a field of Numeric type
    • The value of the field: {{issue.fields['Numeric field'] }}

    • The value of the numeric field minus one:

      {{ issue.fields['Numeric field'] - 1 }}

Project picker type

  • Description: A field of Project picker type is an object describing a project.

  • Structure:

     Click here to see the structure of a field of Project picker type
    Structure
    "issue":
    {
        ...
        ...
        "fields":
        {
            ...
            ...
          "customfield_xxxxx":
            {
                "self":String, //URL of the project.
                "id":String, //ID of the project.
                "key":String, //Key of the project.
                "name":String, //Name of the project.
                "avatarUrls": //URL of the project avatar
                {
                    "48x48":String,
                    "24x24":String,
                    "16x16":String,
                    "32x32":String,
                }
            },
    
    
    		...
        }
    	...
    }
    Example
    "issue":
    {
        ...
        ...
        "fields":
        {
            ...
            ...
           "customfield_10302":
    		{
    			"self":"https://jmwe-test-2.atlassian.net/rest/api/2/project/10300",
    			"id":"10300",
    			"key":"ALRM",
    			"name":"Assign to last role member",
    			"avatarUrls":
    			{
    				"48x48":"https://jmwe-test-2.atlassian.net/secure/projectavatar?avatarId=10324",
    				"24x24":"https://jmwe-test-2.atlassian.net/secure/projectavatar?size=small&avatarId=10324",
    				"16x16":"https://jmwe-test-2.atlassian.net/secure/projectavatar?size=xsmall&avatarId=10324",
    				"32x32":"https://jmwe-test-2.atlassian.net/secure/projectavatar?size=medium&avatarId=10324"
    			}
    		},
    		...
        },
    	...
    }
  • Accessing a field of Project picker type

    • Name of the project: {{ issue.fields['Project picker type field'].name }}

URL field type

  • Description: A field of URL type is a string representation of a URL.

  • Structure:

     Click here to see the structure of a field of URL type
    Structure
    "issue":
    {
        ...
        ...
        "fields":
        {
            ...
            ...
           "customfield_xxxxx":String,
    		...
        }
    	...
    }
    Example
    "issue":
    {
        ...
        ...
        "fields":
        {
            ...
            ...
            "customfield_10300":"https://jmwe-test-2.atlassian.net/rest/api/2/issue/TEST-629"
    		...
        },
    	...
    }
  • Accessing a field of URL type:
    • The value of the URL field: {{ issue.fields['URL field'] }}
  • No labels