JQL functions and variables


JQL Functions

STAGIL Assets introduces new JQL functions that can be used in the advanced issue search and STAGIL custom fields.

issue in relation("","",...,"")

The add-on provides a new JQL function to find all your issues within certain relations. It gives you a list of all related issues, searching from a start node over the given relations. You can also use the parameter “all” in order to search through the entire link network (It may impact your search performance).

issue in relation("", "",...,"", "") issue in relation("start", "relation_1",...,"relation_n", "level") issue in relation("","...", "all")

 

Following parameters are used:

Start - This is the node to start your search from. You can use regular JQL syntax to define your node or nodes. The Start node is always in the result list of your search.

Relation_x - Provide 1 to n names of relations you would like to search for in the asset network. 

Please use the exact names from your relation table. Do not use the inward or outward names.

Level - Provide the depth of your relation as "level1", "level2", "level3" or "level4". Maximal depth is 4.

 

issue not in relation("","",...,"")

This JQL function works exactly as “issue in relation” but will give you the negation of it: all issues that are NOT in relation that you have defined.

JQL Examples

 

Find Organization of a Contact CRM-18
issue in relation("key = CRM-18", "Organization-Contact", "level1")
Find other Contacts in the same Organization like CRM-18.
issue in relation("key = CRM-18", "Organization-Contact", "level2")

You only use the relation "Organization-Contact", but go two levels. First from Contact (CRM-18) to Organization (find CRM-10) and then to other Contacts connected (find CRM-19).

Limit the scope of results

type = Contact AND issue in relation("key = CRM-18", "Organization-Contact", "level2")
Find Task and Subtasks of an given EPIC

You can also use the standard link type of JIRA.

issue in relation("key = EPIC-1","Epic-Story Link","jira_subtask_link" ,"level2")

This search shows where EPIC-1 is a key of some Epic.

JQL Variables

Usage only in STAGIL Assets Dynamic Dependend and  STAGIL Assets Lookup fields. 

The following variables pull data from the issue where the Assets field is located in.

Use apostrophes in case the data to pull contain spaces in between. Example: '{source.customfield_id}'

{sourcekey}

Provides the key of the issue, where the assets field is located in.

{projectkey}

Provides the key of the project of the issue, where the asset field is located in.

{reporter}

Provides the reporter (as user) of the issue, where the assets field is located in.

{currentusermail}

Provides the mail address of the current User who is logged in.

{mail.reporter}

Provides the mail address of the reporter.

{mail.assignee}

Provides the mail address of the assignee.

{mail.customfield_12345}

Provides the mail address of a single user picker custom field.

{source.customfield_id}

Provides data pulled from a selected customfield, based on the current source issue. 

{source.summary}

Provides the summary of the current issue.

currentUser()

Provides the name of the user who is currently logged in. 

searchingUser()

Provides the name of the user who is running the search (can be defined in the configuration menu of asset customfield).

JQL Variable examples

Show all issues, where fixVersion is the same as in current source-issue

This JQL in a Lookup field in an assets issue finds all issues, where fixVersion is the same as in {source.customfield_16404}

fixVersions in ({source.customfield_16404}) 
Give all Service request issues, where the issuekey of the issue is linked in "Affected CI"

This JQL in a Lookup field in an assets issue finds all service requests that are related to the current issue.

 type = "Service Request" AND "Affected CI" = {sourcekey}
Give all issues where the reporter is the same like in this issue.

This JQL in a Lookup field looks up all service requests from the same reporter.

 type = "Service Request" AND reporter = {reporter}
Give all "my" CI's where I am the assignee.

This JQL in a relation custom field provides only assets which "belong" to the current user.

 type in (Smartphone, Notebook, Printer) AND assignee = {currentusermail}

© 2023, STAGIL