In one of our Jira projects, we have a cascaded select field in which the parent is the product name and the child is the customer name.
The field is called 'Prod-Cust'. So we have values like this:
The owner of the project raised a challenging requirement:
In an issue, have the ability to display the last 10 issues in the project for the same Product-Customer.
My first thought was to use a webhook to send a request to Jira, but the overhead of using webhook is quite large.
So next I looked at using 'lookup issues' based on smart values with lists. But it looked complicated.
I then realized that a search in Jira can be executed by sending the browser a full search URL, which is the Jira URL concatenated with /issues/?jql=<JQL-here>.
An advantage is this approach is that your browser is already logged in to Jira, so you don't need any authentication - just send the URL.
So I came up with this plan (let's call it Plan A, you will soon see why).
This worked fine until it started failing. The reason is that URL fields in Jira cloud are limited to 255 characters (there is an open feature request to remove this limitation). So some search URL were longer than 255.
So I came up with Plan B.
This works without a hitch.
1. Getting child/parent values from a cascade field into a smartvalue variable:
{{issue.your-field-name.value}} // Parent
{{issue.your-field-name.child.value}} // Child
2. The JQL for searching by a value of a cascaded field must use this syntax:
<your-field-name> in cascadeOption(<parent-value>, <child-value>)
3. Construction of the text that goes into the big text field:
[Find related tickets|https://xyzzy.atlassian.net/issues/?jql=project%20%3D%20MY-PROJ%20%20and%20%22Prod-Cust%22%20in%20cascadeOption(%22{{SmartValueParent}}%22%2C%20%22{{SmartValueChild}}%22)%20ORDER%20BY%20CREATED%20DESC]
Amir Katz (Outseer)
Technical Lead
Outseer, an RSA company
Israel
21 accepted answers
0 comments