Skip to main content
Skip table of contents

Writing dynamic queries with dependencies

A key feature of Elements Connect is the ability to write dynamic queries using query dependencies.
A query can depend on

  • the value of other Connected items,
  • the nested attributes and objects of other Connected items,
  • the current user editing the items
  • the user input (what the user is typing in the select list)
  • the reporter and its attributes
  • the Project and its attributes
  • the issue type and its attributes
  • the request type and its attributes


Why dynamic queries?

Let's imagine we want to build a dynamic product catalog with multi-level items, connected to a Configuration Management Database (CMDB),
We can imagine 3 items:

  • Category where users select a product category (i.e.: Monitor, Computer, Printer)
  • Product to list all products belonging to the selected category
  • Product details to display all the information of the item selected in Product

Thanks to query dependencies, we can build a dynamic form where Product depends on Category, and Product details depend on Product.
This kind of form cannot be implemented natively in Jira and is made possible thanks to Elements Connect.

The following examples are for SQL queries but the dependencies between Connected items, current user, user input, project, issue type and request type work the same for REST API queries.

i.e: 

Evaluated as String

All parameters are evaluated as String (we use prepared statements to prevent SQL injection). If you want a dependency to be evaluated as another type (such as number or date), you must add an explicit cast.
In the example below we cast the value of the Connected item 10000 as an integer:

Cast dependency

SQL
SELECT product
FROM catalog
WHERE category = $issue.connected_item_10000::integer

In this topic


JavaScript errors detected

Please note, these errors can depend on your browser setup.

If this problem persists, please contact our support.