I am not sure if this is intended or it is a bug, but I wanted to share and see what others think.
I am trying to create a variable inside of a branched JQL lookup and then use that variable outside of the branch.
Referring to my below screen shots, I was trying to access Variable A in the "Advanced Edit" at the bottom of the automation rule (which was located outside of the branched rule.
You can see in box #1, logging the action produced no result.
However, when I added Variable B (at the top) before the branched rule, it then changed something which then allowed me to access variable A outside of the automation rule (refer to box 2) which shows the log action.
Below are screen shots of the entire automation rule if anyone wants to see what I am doing. The custom field 10800 is the Teams field that comes from Advanced Roadmaps, and has limited functionality inside of the automation tool, so I must manually manipulate it.
TL;DR: the variable goes out of scope because of how branches work, and so is null.
Apologies in advance...I tried to write a shorter answer for this and was unable to do so. :^)
Branches which can only be on one-and-only one issue (e.g. on Parent, on Current Issue, etc.) are actually run in-line. And so it is like the branch did not exist (except to help with conditions).
Branches which could be on more than one issue (e.g. JQL, linked issues, etc.) are run in parallel and asynchronously. And so...there is no guarantee of when the branch will finish, until right up to the end of the rule. Stuff that happens inside these branches remains so, except for any issue updates, web requests, etc.
Putting these things together, let's look at an example:
The original community post on create variable, which I cannot find, showed an example where a variable was created before and then inside a branch, and successfully used later. That was a bit misleading as the branch was a one-and-only one issue type.
Often work-arounds for this design need are to rethink what you are trying to capture and use divide-and-conquer (with multiple rules) or lookup issues/objects to sum, average, etc. the data.
Kind regards,
Bill
Hey @Bill Sheboy
Were you referring to this example, that you consider misleading?
My use-case is, I want to aggregate efforts logged by each team (hence branching out once for each team) and then compile them into a confluence document (using the custom web request action)
I am failing to propagate the desired info as I desire, would you have any suggestions for me?
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
Hi @Chiranjib B
Yes, that is one of the examples.
For your use case, perhaps one of these approaches would work:
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.
If I am reading this correctly, we can branch on current issue, create a variable in th branch using JQL to ensure it has a singular value, and then use that variable within the branch and should be fine.
Meaning if we can guarantee we are getting one epic (I am trying to find a key for a single Epic and assign that to the issue as the epic link) it should be possible?
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
I know this is an old question, but I think I have the answer. Any variable created within an IF Branch or a FOR Branch will not be in scope outside of the branch. However, if you create the variable at the very beginning and give it a default value, you can then give it a new value within your branches, and it will be in scope anywhere in the automation.
When I run the automation and check the audit log, the value of myVar is the value set in the branch.
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
Brilliant Andrea! That works beautifully!
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.