Skip to end of banner
Go to start of banner

Custom Keywords

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 2 Current »

Looking for the documentation on the newest versions of Power Scripts for Jira 8? Click here and leave these dusty old pages behind!

A JQL keyword is meta-data for an issue that has been evaluated and saved prior to a JQL search. This type of search will always be faster and more efficient than a traditional, functional search since the results can be indexed and it is less resource intensive. While there are many advantages to this method of searching it means that there are less opportunities for modifications and customizations for JQL searches. The results of a cloud-hosted JQL search can not be controlled or modified. Any customizations must be performed prior to the JQL search.

This does not mean you have less control in Jira Cloud. It just means that there has been a paradigm shift and you must adapt to the new way of doing things.

Custom Keywords

JQL keywords must be pre-registered with Jira and therefore the names can not be customized, only the values. Because of this, Power Scripts for Jira Cloud comes with 3 sets of each keyword data type. This allows you to add custom values to these keywords through scripting.

Dates

  • sil-jql-custom-date-1

  • sil-jql-custom-date-2

Numbers

  • sil-jql-custom-number-1

  • sil-jql-custom-number-2

Strings

  • sil-jql-custom-string-1

  • sil-jql-custom-string-2

Text

  • sil-jql-custom-text-1

  • sil-jql-custom-text-2

Examples

Example 1 - Setting a custom keywords for an external issue id:

if (key == "MYISSUE-54321") {
	return "TEST-12345";
}

Example 2 - Calculating a number used to sort issues by priority:

number priorityNumber;

if(issueType == "Bug") {
    if(arrayElementExists(components, "Outage")) {
        priorityNumber = 1;
    } else if(arrayElementExists(components, "Problem")) {
        priorityNumber = 2;
    } else {
        priorityNumber = 3;
    }
} else if (issueType == "Task") {
    priorityNumber = 4;
}

return priorityNumber;

  • No labels