Dependencies between Connected items
If you have more than one Connected item in a form, you can create dependencies between them.
Database example
Let's say that you have two items:
- Category - To list all the categories of the products stored in a CMDB - item ID is 10000
- Product - To list all the products belonging to the selected category - item ID is 10001
To create a dependency between Product and Category you can reference the Category item in the query of Product by using its ID.
Product query
SELECT product
FROM catalog
WHERE category = $issue.connected_item_10000
Now, from the end-user's perspective, a user selects the Category "Computers": the query of Product is evaluated with this new context and becomes:
Product query evaluated
SELECT product
FROM catalog
WHERE category = 'Computers'
The query is executed and returns all the Products of the selected Category.
REST API example
Let's say that you have two items:
- Project: to list all the projects of your Jira instance
- Issue picker: to list all the issues from the project selected above
To create a dependency between Project and Issue picker you can reference the Project item in the query of Issue picker by using its key.
Issue picker query
/search?jql=project="$issue.connected_item_10002.key"
From an end user perspective, a user selects the Project "Advanced Roadmaps": the query of Issue picker is resolved with this new context and becomes:
Issue picker query resolved
/search?jql=project="Advanced Roadmaps"
Special cases
HTML in the template
When a Connected item is referenced in another connected item query, Elements Connect replaces the reference by the value selected. If HTML is used in the template, the HTML code will be injected in the query.
For example, if the template of the Category item is:
<strong>{Category}</strong>
Then, the query of the Product Connected item will be:
Dependency example
SELECT product
FROM catalog
WHERE category = '<strong>Computers</strong>'
Missing or empty value
If a value referenced in a Connected item is either:
- not valid - the Connected item is not on the form or it does not exist
- empty - the user hasn't selected any value
then the variable will be replaced by an empty string.
In the previous "Category / Product" example if the Category Connected item (ID 10000) is not on the form or empty, the query is evaluated to:
Missing reference
SELECT product
FROM catalog
WHERE category = ''
Circular dependency
Elements Connect does not allow circular dependencies:
- A Connected item cannot reference itself
- It is not possible to have a loop in the dependency chain (i.e.: A → B → C → A is not authorized)
If a circular dependency is detected in a query, Elements Connect does not execute the query and an error message is displayed to the user editing the item.
Dependency to Select list (multiple choices) Connected items
Elements Connect does not yet support dependencies to Connected items of type "Select list (multiple choices)".
If you configure a Connected item with a dependency to a "Select list (multiple choices)" Connected item, the following error will display "Dependencies to Select list (multiple choices) are not yet supported. Remove dependency.".
If this is something that you require, do not hesitate to contact us and let us know about it.