Versions Compared

Key

  • This line was added.
  • This line was removed.
  • Formatting was changed.

This page explains how to access the value of Predefined custom 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.

...

Panel
borderStylesolid

Flagged

  • Field name: Flagged

  • Description: The Flagged field is an object representing the status array of objects. Each object represents an option of the Epic.checkbox. By default, there's only one possible value: Impediment

  • Structure:

    Expand
    titleClick here to see the structure of the Epic status Flagged field


    Section


    Column


    Code Block
    titleStructure
    linenumberstrue
    "issue":
    {
       	 ...
      	  ...
    	    "fields":
        	{
    		
            ...
    		
            ...
    		"customfield_xxxxx":
    		[
            	{
    		
                	"self":String, //URL of the Epic status
    			choice
                	"value":String, //Value of the Epic status
    			 choice
                	"id":String //ID of the Epicchoice
    status
    			},
    		...
    		...
    	}
    	]
          },
            ...
        }
        ...
    }



    Column
    width700px


    Code Block
    titleExample
    linenumberstrue
    "issue":
    {
    	...
    	...
    	"fields":
    	{
    		....
    		....
    		"customfield_1001911300":
    		{
    			"self":"https://jmwe-test-2.atlassian.net/rest/api/2/customFieldOption/1000010600",
    			"value":"To DoImpediment",
    			"id":"1000010600"
    		},
    		...
    	}
    	...
    }





  • Accessing the Epic status Flagged field
    • Epic status value: {{

      The value of the last option selected in the Flagged field

      Code Block
      {{ issue.fields["Flagged"] | last | field("value") }}


    • Display the values of all selected options, separated by a comma:

      Code Block
      {{ issue.fields[
      'Epic Status'].value }}Epic status ID: {{ issue.fields['Epic Status'].id
      "Flagged"] | join(",","value") }}


    • Test whether the issue has been flagged:

      Code Block
      {{ issue.fields["Flagged"] | find({"value":"Impediment"}) != null }}



Panel
borderStylesolid

Sprint

  • Field name: Sprint

  • Description: The Sprint field is an array of strings.

  • Structure:

    Expand
    titleClick here to see the structure of the Sprint field


    Section


    Column


    Code Block
    titleStructure
    linenumberstrue
    "issue":
    {
    	...
    	...
    	"fields":
    	{
    		...
    		...
    		"customfield_xxxxx":
    		[
    			"String"
    		]
    		...
    	}
    	...
    }



    Column
    width700px


    Code Block
    titleExample
    linenumberstrue
    "issue":
    {
    	...
    	...
    	"fields":
    	{
    		...
    		...
    		"customfield_10017":
    		[
    			"com.atlassian.greenhopper.service.sprint.Sprint@16e2448
    			[
    				id=3,
    				rapidViewId=3,
    				state=FUTURE,
    				name=CFLIORT Sprint 3,
    				goal=<null>,
    				startDate=<null>,
    				endDate=<null>,
    				completeDate=<null>,
    				sequence=3
    			]"
    		]
    		...
    	}
    	...
    }





  • Accessing the Sprint field: Because each string is an internal representation of a Sprint, accessing this field is not of much use.

...

Panel
borderStylesolid

Approvals

  • Field name: Approvals

  • Description: The Approvals field is a string representation of a multi-line text describing the search options for Jira Service Desk approvals information.

  • Structure:

    Expand
    titleClick here to see the structure of the Approvals field


    Section


    Column


    Code Block
    titleStructure
    linenumberstrue
    "issue":
    {
    	...
    	...
    	"fields":
    	{
    		...
    		...
    		"customfield_xxxxx":String,
    		...
    	}
    	...
    }



    Column
    width700px


    Code Block
    titleExample
    linenumberstrue
    "issue":
    {
    	...
    	...
    	"fields":
    	{
    		...
    		...
    		"customfield_10002":"com.atlassian.servicedesk.plugins.approvals.internal.customfield.ApprovalsCFValue@195c4e9",
    		...
    	}
    	...
    }





  • Accessing the Approvals field: Accessing this field is not of much use.

...

Panel
borderStylesolid

Customer Request Type

  • Field name: Customer Request Type

  • Description: The Customer request type field represents an object describing the information about the Service Desk used to create the ticket.

  • Structure:

    Expand
    titleClick here to see the structure of the Customer request type fields


    Section


    Column


    Code Block
    titleStructure
    linenumberstrue
    "issue":
    {
    	...
    	...
    	"fields":
    	{
    		...
    		...
    		"customfield_xxxxx":
    		{
    			"_links":
    			{
    				"jiraRest": String, // URL of the rest api
    				"web": String, //URL of the ticket
    				"self": String //URL of the request
    			},
    			"requestType":
    			{
    				"id": String, //ID of the request type
    				"_links":
    				{
    					"self": String //URL of the request type
    				},
    				"name": String, //Name of the request type
    				"description": String, //Description of the request type
    				"helpText": String, //Help text of the request type
    				"serviceDeskId": String, //Service desk ID
    				"groupIds":[String], //Array of group ID's
    				"icon":
    				{
    					"id": String, //ID of the icon
    					"_links":
    					{
    						"iconUrls":
    						{
    							"48x48": String, //URL of the icon avatar
    							"24x24": String, //URL of the icon avatar
    							"16x16": String, //URL of the icon avatar
    							"32x32": String //URL of the icon avatar
    						}
    					}
    				}
    			},
    		},
    		...
    	},
    }



    Column
    width700px


    Code Block
    titleExample
    linenumberstrue
    "issue":
    {
    	...
    	...
    	"fields":
    	{
    		...
    		...
    		"customfield_10023":
    		{
    			"_links":
    			{
    				"jiraRest":"https://jmwe-test-2.atlassian.net/rest/api/2/issue/30333",
    				"web":"https://jmwe-test-2.atlassian.net/servicedesk/customer/portal/3/PSDF-25",
    				"self":"https://jmwe-test-2.atlassian.net/rest/servicedeskapi/request/30333"
    			},
    			"requestType":
    			{
    				"id":"18",
    				"_links":
    				{
    					"self":"https://jmwe-test-2.atlassian.net/rest/servicedeskapi/servicedesk/3/requesttype/18"
    				},
    				"name":"Get IT help",
    				"description":"Get assistance for general IT problems and questions [example]",
    				"helpText":"Get assistance for general IT problems and questions [example]",
    				"serviceDeskId":"3",
    				"groupIds":["7"],
    				"icon":
    				{
    					"id":"10527",
    					"_links":
    					{
    						"iconUrls":
    						{
    							"48x48":"https://jmwe-test-2.atlassian.net/secure/viewavatar?avatarType=SD_REQTYPE&size=large&avatarId=10527",
    							"24x24":"https://jmwe-test-2.atlassian.net/secure/viewavatar?avatarType=SD_REQTYPE&size=small&avatarId=10527",
    							"16x16":"https://jmwe-test-2.atlassian.net/secure/viewavatar?vatarType=SD_REQTYPE&size=xsmall&avatarId=10527",
    							"32x32":"https://jmwe-test-2.atlassian.net/secure/viewavatar?	
    							avatarType=SD_REQTYPE&size=medium&avatarId=10527"
    						}
    					}
    				}
    			},
    		},
    		...
    	},
    }





  • Accessing the Customer request type field
    • Name of the Customer request type: {{ issue.fields['Customer Request Type'].requestType.name }}

    • Description of the Customer request type: {{ issue.fields['Customer Request Type'].requestType.description }}

...

Panel
borderStylesolid

Satisfaction

  • Field name: Satisfaction

  • Description: The Satisfaction field is a string representation of a multi-line text describing the request feedback in Service Desk requests.

  • Structure:

    Expand
    titleClick here to see the structure of the Satisfaction field


    Section


    Column


    Code Block
    titleStructure
    linenumberstrue
    "issue":
    {
    	...
    	...
    	"fields":
    	{
    		...
    		...
    		"customfield_xxxxx": String,
    		...
    	}
    	...
    }



    Column
    width700px


    Code Block
    titleExample
    linenumberstrue
    "issue":
    {
    	...
    	...
    	"fields":
    	{
    		...
    		...
    		"customfield_10025":"com.atlassian.servicedesk.internal.api.customfields.feedback.RequestFeedbackCFValue@d3f24"
    	...
    	}
    	...
    }





  • Accessing the Satisfaction fieldAccessing this field is not of much use.

...