Dependencies to attributes and nested objects of connected items
Dependencies to connected item attributes
In the case of a Connected item that has several attributes, instead of creating a Connected item that depends on the Connected item display template like explained above, you can decide to create a Connected item that depends on one or more of the Connected item attributes.
You can only configure dependencies to attributes of Select list Connected items for now.
Let's say you want to create two Connected items for the following:
- Issue picker - to list all the issues of a specific project
- Issue status - to display the status based on the key of the issue selected in the "Issue picker" Connected item
Let's take a look at how these Connected items would be configured.
This example uses Jira REST API as a datasource. Refer to this tutorial for details on how to configure it.
Issue picker
Let's create a Connected item that fetches issues from a specific project, "ITSM project" in this case.
Type: Select list
Query:
https://yoursite.atlassian.net/rest/api/search?jql=project="ITSM project"
Location of options in the response: issues
Template:
<img src="${row.fields.issuetype.iconUrl}" height=16 style="vertical-align:sub;"/> <a href="https://jira.atlassian.com/browse/${row.key}" target="_blank">${row.key}</a> - ${row.fields.summary}
The query is executed and returns the key and summary of all issues in the "ITSM project" project.
Issue status
Now we want to configure a read-only connected item that displays the status based on the key of the issue selected in the "Issue picker" connected item ($issue.connected_item_10001).
Type: Read-only
Query:
Issue status - Query
https://yoursite.atlassian.net/rest/api/issue/$issue.connected_item_10001.key
Template:
Issue status - Template
${data.fields.status.name}
The query is executed and returns the status of the issue selected in the "Issue picker" connected item.
Dependencies to connected item nested objects
If you have a connected item that consists of nested objects, you can create connected items that depend on these nested objects and their underlying attributes.
Let's say you want to create two connected items for the following:
- Issue picker - to list all the issues of a specific project
- Similar issues - to list issues with the same issue type and status as the issue selected in the "Issue picker" connected item
Let's take a look at how these connected items would be configured.
Note: this example uses Jira REST API as a datasource.
Issue picker
Let's create a connected item that fetches issues from a specific project, "ITSM project" in this case.
Type: Select list
Query:
Issue picker - Query
https://yoursite.atlassian.net/rest/api/search?jql=project="ITSM project"
Location of options in the response: issues
Template:
Issue picker - Template
<img src="${row.fields.issuetype.iconUrl}" height=16 style="vertical-align:sub;"/> <a href="https://jira.atlassian.com/browse/${row.key}" target="_blank">${row.key}</a> - ${row.fields.summary}
The query is executed and returns the key and summary of all issues in the "ITSM project" project.
Similar issues
Now, let's create a connected item that fetches issues that have the same issue type and the same status as the issue selected in the above "Issue picker" connected item (($issue.connected_item_10001).
Before we go into the configuration, let's give some context.
A Jira issue is an object that consists of an array of attributes in the form of key-value pairs:
- "expand": <value>
- "id": <value>
- "self": <value>
- "key": <value>
- "fields": <value>
The information about the issue type and the status of the issue are contained under the "fields" attribute.
The "fields" attribute is itself an object which is comprised of various attributes, among which "issueType" and "status".
issueType and status also are objects that are described by attributes in the form of the following key-value pairs:
issueType | status |
---|---|
|
|
In order to fetch issues that have the same issue type and the same status as the issue selected, we need to reference the access path all the way to the attribute "name" of the issueType object and the attribute "name" of the status object in the query.
Let's see what the configuration looks like:
Type: Select list
Query:
Issue type and status - query
/search?jql=project="ITSM project" AND issuetype = "$issue.connected_item_10001.fields.issuetype.name" AND status= "$issue.connected_item_10001.fields.status.name"
Location of options in the response: issues
Template:
Issue type and status - Template
<img src="${row.fields.issuetype.iconUrl}" height=16 style="vertical-align:sub;"/> <a href="https://jira.atlassian.com/browse/${row.key}" target="_blank">${row.key}</a> - ${row.fields.summary}
The query is executed and returns the key and summary of all the issues with the same issue type and status as the issue selected in the "Issue picker" connected item.