Using Jira Version 8.22.1 project automation
The Setup:
A 'story' Issue contains a linked 'test' issue of "tested by"
When the test issue transitions to a fail, it triggers a transition on the story issue which triggers this automation flow.
When this automation flow is triggered, I create a 'defect' issue using a current issue branch and link the defect as blocking to the story.
I then have a second branch "for linked issues", to the story, which targets the test issue.
The Problem:
I am attempting to link the test issue to the defect issue by using the 'most recently created issue' from the 'link issues' action, but the issue key of the created defect issue can't be found; however, it is in the log output.
There are several articles similar to this but none of the solutions work.
LOG OUTPUT:
I believe you are seeing this defect/symptom where the {{createdIssue}} smart value is not visible to the scope outside of an if/else or branch in which the issue was created: https://jira.atlassian.com/browse/AUTO-154
Without seeing your entire automation rule, my suggestion would be to consider how you might restructure the rule so the create issue action is at the same scope where you need the {{createdIssue}} smart value. Please post an image of your entire rule if you want ideas to help with that.
Kind regards,
Bill
Thank you for that but it is contained with a single 'if' rule. Here is the whole view:
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
I do not believe you need the For Current Issue branch as it is just nesting down from the trigger issue. Instead you can just reference {{issue}} or {{triggerIssue}} as needed.
Please try removing that branch to see if the {{createdIssue}} smart value becomes more visible to the branch below it.
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
Bill, you are a savior. That was the issue. removing the initial branch fixed it.
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
I am glad to learn that helped.
I find this symptom/defect curious as my understanding was that branches on one-and-only-one thing (e.g., branch to current issue) get converted to in-line code, as if the branch did not exist. Compare that to branches which could be on more than one thing (e.g., linked issues, JQL, etc.) which get run in parallel and asynchronously, in separate processes. I guess the "branch scoping" rules outweigh the in-line stuff for this symptom.
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
Another work around is to define `{{createdIssue}}` at the top level, that will make its scope global. (as read somewhere in one of the multiple documentation pages, can't remember where).
So, you define {{createdIssue}} = 0
and after creating the issue, the variable will have the new issue's details.
then, you may want to add somewhere "if {{createdIssue}} != 0 then..etc", to check the branch where the new issue was created was actually entered
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
Hi @Rafa
Have you tested this suggestion you propose?
I wonder about it:
Regardless, the simplest fix for the original rule was just to remove the branch on current issue, as the rule structure did not need it.
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 ,
yes it works, I use it on a couple automation rules. In one of them I use it to get the "Most Recent created issue key" to link it to others, but for "reasons", I need to do it outside of the branch where the issue gets created. So I store the key, and lower down the execution, I check the key of the issue created earlier. (see screenshot of 2 rules)
This was described by an "Atlassian Team" user in either an article or an answer (I can't remember or find where, since I've opened hundreds of tabs in the past weeks).
Regardless, the simplest fix for the original rule was just to remove the branch on current issue, as the rule structure did not need it.
Correct. Your answer solved the OP's issue by avoiding the problem to begin with. Whereas my answer gives a more general solution (or workaround) to the "Most Recent created issue key not found in automation" problem. Win-win : )
PS: Where do you get that branches are run "in parallel and asynchronously"? Rules doe run in parallel and async, but branches within an automation rule seem pretty sequential to me.
Maybe you thought I meant global variables across automation rules or executions of an automation rules? (I didn't)
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
For this technique with one-and-only-one-thing branches, I recommend using a different variable name. There is no documentation of the expected behavior when shadowing a built-in smart value name.
Regarding branch execution with could-be-more-than-one-thing, there have been several community posts from Atlassian team members on this. And here is the reference in the documentation, although they do not use the technical terms to avoid confusing customers: https://support.atlassian.com/cloud-automation/docs/jira-automation-branches/#Ordering-of-branch-executions
There is an open suggestion to add the ability to select sequential processing, or at least add a "wait until done" for branches as exists for the Send Web Request action. Please look here to find that one: https://jira.atlassian.com/browse/AUTO-32
Regarding "global", I did think you meant within the scope of one rule.
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
Hi
I recommend using a different variable name. There is no documentation of the expected behavior when shadowing a built-in smart value name.
Some "atlassian team" user suggested that particular use (I would not have thought of it myself). And it's the only way I can see to make "link most recently created issue" work.
Although it would not surprise me that their documentation and suggestions were not in sync..
Regarding branch execution...
Interesting. Dind't know that. Thanks for the link.
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
Online forums and learning are now in one easy-to-use experience.
By continuing, you accept the updated Community Terms of Use and acknowledge the Privacy Policy. Your public name, photo, and achievements may be publicly visible and available in search engines.
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.