Skip to content

Template Functions

This page contains a list of all Template Functions available and instructions on how to use them.

fromJson:

  • The fromJson: template function is used to convert any JSON string into a JSON object. It is used to allow you to template JSON objects together, and inject data into your components from other sources.
  • This function takes a string as an argument.

Example:

  • The example below shows someone passing a flat JSON string to the fromJson: function.
  • App Maker would not normally be able to access the data inside the JSON string because it doesn't see it as an object (just a piece of text).
json
{
  "type": "DynamicTable",
  "tableRows": "{{fromJson: '[{\"key\": \"ISSUE-123\", \"fields\": {\"summary\": \"Issue 1 Summary\", \"status\": \"Open\"}}]'}}"
}
  • The outcome of this function would be a proper JSON object that can be used by App Maker to access the data.
  • e.g. using fields.summary to access the field containing "Issue 1 Summary" from the table row.
json
{
    "type": "DynamicTable",
    "tableRows": [
        {
            "key": "ISSUE-123",
            "fields": {
                "summary": "Issue 1 Summary",
                "status": "Open"
            }
        }
    ]
}

jiraIssues:

  • The jiraIssues: template function is used to fetch the full details of a list of Jira Issues based on their keys.
  • This function takes a list of strings as an argument, where each string is a Jira Issue key.

Example:

The example below shows someone passing a list of Jira Issue keys to the jiraIssues: function.

json
{
  "type": "DynamicTable",
  "tableRows": "{{jiraIssues: ['ISSUE-123', 'ISSUE-456', 'ISSUE-789']}}"
}

The outcome of this function would be a list of all the Jira Issues with the keys ISSUE-123, ISSUE-456, and ISSUE-789.

json
{
	"type": "DynamicTable",
	"tableRows": [
		{
			"key": "ISSUE-123",
			"fields": {
				"summary": "Issue 1 Summary",
				"status": "Open"
			}
		},
		{
			"key": "ISSUE-456",
			"fields": {
				"summary": "Issue 2 Summary",
				"status": "In Progress"
			}
		},
		{
			"key": "ISSUE-789",
			"fields": {
				"summary": "Issue 3 Summary",
				"status": "Closed"
			}
		}
	]
}

childIssues:

  • The childIssues: template function is used to fetch the full details of all the issues that are the "children" of the issue that is passed to the template function (usually the issue being viewed by the user).
  • This function takes a Jira Issue object (or any object with a key property; e.g. {"key": "ISSUE-123"}) as an argument.

Example:

The example below shows someone passing a Jira Issue object to the childIssues: function.

json
{
  "type": "DynamicTable",
  "tableRows": "{{childIssues: jiraIssue}}"
}
  • The outcome of this function would be a list of all the child issues of the issue that was passed to the template function.
json
{
    "type": "DynamicTable",
    "tableRows": [
        {
            "key": "ISSUE-456",
            "fields": {
                "summary": "Child Issue 1 Summary",
                "status": "Open",
                ...
            }
        },
        {
            "key": "ISSUE-789",
            "fields": {
                "summary": "Child Issue 2 Summary",
                "status": "In Progress",
                ...
            }
        }
    ]
}

linkedIssues:

  • The linkedIssues: template function is used to fetch the full details of all the issues that are linked to (e.g "depends on", "blocks", etc) the issue that is passed to the template function (usually the issue being viewed by the user), as well as the details of how they are linked (e.g. "blocked by", "depends on", etc).
  • This function takes a Jira Issue object (or any object with a key property; e.g. {"key": "ISSUE-123"}) as an argument.

Example:

The example below shows someone passing a Jira Issue object to the linkedIssues: function.

json
{
  "type": "DynamicTable",
  "tableRows": "{{linkedIssues: jiraIssue}}"
}
  • The outcome of this function would be a list of all the "issue links" are relevant to the issue that was passed to the template function.
  • An "issue link" contains both the details of the issue being linked to, as well as all the details of how the two issues are linked.
json
{
    "type": "DynamicTable",
    "tableRows": [
        {
            "linkType": "blocks",
            "type": {
                "id": "10000",
                "name": "Blocks",
                "inward": "is blocked by",
                "outward": "blocks",
                "self": "https://api.atlassian.com/ex/jira/"
            },
            "linkedIssue": {
                "id": "10006",
                "self": "https://api.atlassian.com/ex/jira/",
                "key": "AMT-5",
                "fields": {"...all the details of the linked issue..."}
            },
            "id": "10001",
            "self": "https://api.atlassian.com/ex/jira/"
        },
        {
            "linkType": "is blocked by",
            "type": {
                "id": "10000",
                "name": "Blocks",
                "inward": "is blocked by",
                "outward": "blocks",
                "self": "https://api.atlassian.com/ex/jira/"
            },
            "linkedIssue": {
                "id": "10005",
                "self": "https://api.atlassian.com/ex/jira/",
                "key": "AMT-4",
                "fields": {"...all the details of the linked issue..."}
            },
            "id": "10002",
            "self": "https://api.atlassian.com/ex/jira/"
        }
    ]
}

list:

  • The list: template function is used to access the data in a list that has been created by the user.
  • This function takes the list itself as an argument.

Example:

The example below shows someone passing a list of objects to the list: function. The list being passed is scoped to the site, and is called myList.

json
{
  "type": "DynamicTable",
  "tableRows": "{{list: lists.site.myList}}"
}
  • The outcome of this function would be a list of all the objects in the list lists.site.myList.
json
{
    "type": "DynamicTable",
    "tableRows": [
        {
          "my-key": "my-value"
        },
        {
          "another-key": "another-value"
        }
    ]
}