Our new Appfire Documentation Space is now live!

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

Accessing the details of an issue or a transition in Nunjucks

This document explains how to access the details of issue and transition objects, such as those available through the issue and transition variables. To see an example of the structure of an issue go to <base_URL_of_Jira>/rest/api/latest/issue/{issueKey}. The fields displayed through this REST API actually depend on the fields set on the issue. 

Structure of an issue object

An issue object consists of the issue key and a collection of fields. The structure of the issue object (such as those available through the issue, sourceIssue and linkedIssue variables) is the same as that returned by the /rest/api/latest/issue REST resource documented here

issue object

  • Description: The issue object is an object with the following fields.

  • Structure :

     Click here to see the structure of issue variable
    Structure
    {
        "expand": String, //Parts of response
        "id":String, //ID of the issue.
        "self":String, //URL of the issue.
        "key":String, //Key of the issue.
        "fields": 
        {
    		...
    		...
    	}
    }
    Example
    {
        "expand":"renderedFields,names,schema,operations,editmeta,changelog,versionedRepresentations",
    	"id":"30101",
    	"self":"https://jmwe-test-2.atlassian.net/rest/api/latest/issue/30101",
    	"key":"TEST-628",
    	"fields":
        {
    		...
    		...
    	}
    }

Accessing issue details using Nunjucks

Structure of the transition variable

The transition variable describes the current workflow transition. You might want to look at the log entries of a post-function execution to see the structure. The transition of an issue consists of the following fields :

transitionName

  • Description : The name of the current transition.

  • Structure :

     Click here to see the structure of transitionName field
    Structure
    {
    	"transition":
    	{
    		...
    		"transitionName": String, //Name of the transition
    		...
    	},
    }
    Example
    {
    	"transition":
    	{
    		...
    		"transitionName": "Start Progress",
    		...
    	},
    }
  • Access the transitionName field :

    • Name of the transition - {{transition.transitionName}}

transitionId

  • Description : The ID of the current transition.

  • Structure :

     Click here to see the structure of transitionId field
    Structure
    {
    	"transition":
    	{
    		...
    		"transitionId": String, //ID of the transition
    		...
    	},
    }
    Example
    {
    	"transition":
    	{
    		...
    		"transitionId": "10000",
    		...
    	},
    }
  • Accessing the transitionId field :

    • {{transition.transitionId}}

from_status

  • Description : The status from which the current transition starts.

  • Structure :

     Click here to see the structure of from_status field
    Structure
    {
    	"transition":
    	{
    		...
    		"from_status": String, //From status of the transition
    		...
    	},
    }
    Example
    {
    	"transition":
    	{
    		...
    		"from_status": "Open",
    		...
    	},
    }
  • Accessing the from_status field :

    • {{transition.from_status}}

to_status

  • Description : The status to which the current transition leads

  • Structure :

     Click here to see the structure of to_status field
    Structure
    {
    	"transition":
    	{
    		...
    		"to_status": String, //To status of the transition
    		...
    	},
    }
    Example
    {
    	"transition":
    	{
    		...
    		"to_status": "Done",
    		...
    	},
    }
  • Accessing the to_status field :

    • {{transition.to_status}}

workflowName

  • Description : The name of the workflow the transition belongs to.

  • Structure :

     Click here to see the structure of workflowName field
    Structure
    {
    	"transition":
    	{
    		...
    		"workflowName": String, //Workflow name of the transition
    		...
    	},
    }
    Example
    {
    	"transition":
    	{
    		...
    		"workflowName": "TEST Workflow",
    		...
    	},
    }

    Accessing the workflowName field :

    • {{transition.workflowName}}

workflowId

  • Description : The ID of the workflow the transition belongs to.

  • Structure :

     Click here to see the structure of workflowID field
    Structure
    {
    	"transition":
    	{
    		...
    		"workflowId": String, //Workflow ID the transition belongs to
    		...
    	},
    }
    Example
    {
    	"transition":
    	{
    		...
    		"workflowId": "10000",
    		...
    	},
    }
  • Accessing the workflowID field :

    • {{transition.workflowId}}