Hello
I am writing jira automation. I also want to receive the link of the blocked task in a task message in the e-mail body.
example:
Task-1 is blocked by Task-2
Can you help me give the URL link of both of these by using smart value in the e-mail body?
{{url}} yes, but how do I find the links of those like blocked, or blocked by?
Hi @Talha Aras
For a question like this, please post an image of your complete automation rule, images of any relevant actions / conditions / branches, an image of the audit log details showing the rule execution, and explain what is not working as expected. Those will provide context for the community to offer ideas. Thanks!
Until we see those...
There are at least two ways to find the issues linked by a specific type:
Kind regards,
Bill
Hey @Bill Sheboy ,
if I wanted to get the Key of a "cloned" linked issue - how would the smart value list filtering work? :)
My automation uses:
"key": "{{issue.parent.issuelinks}}"
I tried:
"key": "{{issue.parent.issuelinks}} {{if(isClones)}}"
and it throws errors
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
The issuelinks smart value is a list of values, and so a list iterator must be used to access the values and filter them. And the structure depends upon the link direction: inward, outward, or both. Putting this ideas together...
First, I recommend using this how-to article to better understand the structure of the smart values in the issue. That will help when creating list filtering. https://support.atlassian.com/cloud-automation/docs/find-the-smart-value-for-a-field/
Assuming the {{issue}} is the one cloned-from and you want to get the issue it was cloned-to, you could use this:
{{#issue.issuelinks}}{{#if(equals(type.inward,"is cloned by"))}}{{inwardissue.key}}{{/}}{{/}}
Kind regards,
Bill
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
Hey @Bill Sheboy ,
thank you so much - it fixed my Automation :)
for me it was:
"key": "{{#issue.parent.issuelinks}}{{#if(equals(type.outward, "clones"))}}{{outwardissue.key}}{{/}}{{/}}"
Kind regards
Khira
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
Just an additional thought for those who are researching this topic.
Don't forget to place a Re-fetch issue data step if you have created some of the linked issues newly in a branch.
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
Hi @József Porohnavec -- Welcome to the Atlassian Community!
Updating issues and using a Re-fetch Issue action within any branch which could be on more than one issue may not help / work.
The reason is such branches execute in parallel and asynchronously. As a result, edits could collide, have errors, and lead to inconsistent updates of an issue. In such cases it may be better to redesign the rule flow.
Kind regards,
Bill
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
Hi @Bill Sheboy,
What if I have a pair of linked issues with the link types "is delivered by" and "delivers". What I'm trying to solve is:
1. Issue A is delivered by Issue B.
2. From the jira project that Issue A resides, I have a rule to send a slack message based on set condition. In the message, rather than list the Issue A's url, I wish to show Issue B's url.
Question is - what is the smart value for that?
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
Hi @Nathan Yam
Typically the "is [...] by" link types have the inward direction, but you have to look it up in your settings, to be sure.
I believe what you're looking for is
{{#issue.issuelinks}}{{#if(equals(type.inward,"is delivered by"))}}{{inwardissue.url}}{{/}}{{/}}
This will give you all the URLs of the issues if the automation rules run on Issue A where Issue A is linked to Issue B with the "is delivered by" inward link type.
You could reduce the links to the last one created by using the {{#issue.issuelinks.last}} selector in the smart value if necessary.
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
Thanks for your reply. I tried
{{#issue.issuelinks}}{{#if(equals(type.inward,"is delivered by"))}}{{inwardissue.url}}{{/}}{{/}}
but nothing is returned in the slack message. Thought I'd also try changing inward to outward, still doesn't work.
Tried {{#issue.issuelinks.last}} but I got an error message in the audit log:
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
Hi @Nathan Yam,
First I'd recommend getting familiar with smart value lists and filtering in the article mentioned above by Bill https://community.atlassian.com/t5/Automation-articles/Filtering-smart-value-lists/ba-p/1827588
What I meant by experimenting with the {{#issue.issueLinks.last}} selector is to modify your original scope of the variable to the last issue if you don't need them all (because perhaps there are multiple issues linked with the is delivered by link) resulting the following expression:
{{#issue.issuelinks.last}}{{#if(equals(type.inward,"is delivered by"))}}{{inwardissue.url}}{{/}}{{/}}
However, the fact that nothing is returned in the slack message signals that the smart value might be empty: I suggest experimenting and debugging by checking what is returned while the automation is running by placing a Log action in your automation and checking what issue link data actually exist on the particular issue via the REST API described here: https://support.atlassian.com/cloud-automation/docs/find-the-smart-value-for-a-field/
Placing {{issue.issueLinks.outwardIssue}} and {{issue.issueLinks.inwardIssue}} in the Log action at least should return all the issue keys linked and you can work your way from there to the URLs.
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
Using the log action together with debug, I found that {{issue.issueLinks.inwardIssue}} returns the linked issue key.
I then swapped out the above smart value with one you originally provided:
{{#issue.issuelinks}}{{#if(equals(type.inward,"is delivered by"))}}{{inwardissue.url}}{{/}}{{/}}
And I can see the linked issue URL listed on the audit log exactly as I want it.
But when I pasted the original smart value into my Slack automation rule, nothing is returned.
I then decided to try using {{issue.issueLinks.inwardIssue}} in my Slack automation rule instead through:
https://<....>.atlassian.net/browse/{{issue.issuelinks.inwardIssue}}
But the smart value is empty too. So it seems like the problem isn't with the smart values you suggested by the rule. Wondering if I should have to change the scope to Global.
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
Hi @Nathan Yam
Taking your example, if Issue B is in another project adding that project to the automation scope could be a good idea, however, if the log action/debug is able to return the correct value then this is a hint that the automation "sees" the project.
Maybe it's something to do with the Slack integration, filtering URLs, but I'm not familiar with Slack that much. If you place the issue URL verbatim in the message that is supposed to be sent by Slack does it appear on the other end?
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
Hi @Nathan Yam
Sometimes rules have order-of-evaluation or racetrack-timing challenges. When this happens, a smart value expression may not fully evaluate before it is used, leading to null values and possibly rule errors.
This symptom can happen with JSON in the Edit Issue and Send Web Request actions, message actions with a body field (e.g., email, Slack, etc.), and with smart values that are dynamically looked-up just-in-time (e.g., subtasks, issuelinks, marketplace addon fields, etc.)
To fix this, use the Create Variable action to first save the smart value expression, allowing it to be fully evaluated. Then use the variable in the message action. This technique also helps with debugging as the variable may be logged to check the value.
Kind regards,
Bill
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
Hi @Bill Sheboy
Thanks for chiming in. I only recently started learning to do all of these so do you mind sharing a screenshot to make it easier to follow?
I only know of the Advanced branching functionality to assign a variable name to a smart value, not sure how to do it with the Create issue action. Saying that, I failed to make it work with the advanced branching functionality.
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
Oops, typo in my earlier post!
I meant to suggest using the Create Variable action: https://support.atlassian.com/cloud-automation/docs/jira-automation-actions/#Create-variable
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
@Bill Sheboy @József Porohnavec thank you both so so much! I finally got it to work.
I happen to decide to put the Re-fetch issue data action before the Create Variable action and the linked issue URL finally appeared in the Slack message. I then tested removing the Create Variable action and just like the below smart value Jozsef originally suggested into the message field and that also was a success.
{{#issue.issuelinks}}{{#if(equals(type.inward,"is delivered by"))}}{{inwardissue.url}}{{/}}{{/}}
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
Hi @Nathan Yam, I'm glad it worked out in the end. @Bill Sheboy great insight about the race condition and the Create Variable action.
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
I was solving a similar problem. Deep clone works great, but won't also clone the linked ticket that is 'cloned by' and this helped me solve it. Thanks!
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.