Create
cancel
Showing results for 
Search instead for 
Did you mean: 
Sign up Log in

It's not the same without you

Join the community to find out what other Atlassian users are discussing, debating and creating.

Atlassian Community Hero Image Collage

Branching over smart values in Jira Automation

Hello everyone,

One of the most commonly asked questions we receive here in the Jira Automation team is whether or not it is possible to branch over smart values. We are very excited to announce that we have introduced a new feature, called Advanced Branching, which now allows this functionality! (Jira Cloud only)

 

Why would you do that?

Some of the use cases this addresses:

  • Iterating over a list, such as a list of issues from Lookup Issues action, and performing an action on each of these issues

  • Filtering lists using conditions to only perform actions on items which match

  • Branching on any list or single object that is available in the smart value context, such as comments, versions, users etc.

 

How do I do it?

The Branch component now has two different branching options, the usual Branch rule / related issues, and the new Advanced branching

 

New Branching.png

Selecting Advanced branching will present you with options to configure your branch. You specify the smart value you want to branch on, such as {{issue.comments}}.

Next, you specify a variable smart value name to use inside the branch, which will be the smart value you use to access the branched item. For example, if you were to branch on {{issue.comments}}, you might want to call it myComment.

 

Advanced Branching.png

Now, inside the branch, you can use the smart value {{myComment}} to access each comment in the list of {{issue.comments}}. The new smart value created is the full object from the original smart value, so you can access fields and methods on the branch object, such as {{myComment.body}}.

Logging.png

 

Where can I find more information?

There are a lot of advanced use cases this feature enables. For more information about branching and smart values, here are some documents which you may find helpful:

And of course, if you have any difficulties or want further information, please don’t hesitate to chat to us here in the community and comments below, or reach out via support.

Cheers!

Sam

15 comments

@Sam Harding Thanks Sam!

Page Bookmarked.

Like Sam Harding likes this

Great news! That's a long awaited feature :)

Like Sam Harding likes this

Thanks, @Sam Harding !

This could come in handy, as it appears to support a created variable as a source smart value, leading to generic loop processing or pulling apart just-in-time created lists.  Now if variables just had an edit action and Lookup contained all of the issue fields...  :^)

Keep up the great work!

Best regards,
Bill

Like # people like this
Darryl Lee Community Leader Jul 14, 2021

Ha seriously @Bill Sheboy - how many answers have we written where the answer was, "Well unfortunately Automation can't do this right now..."

Hi, @Darryl Lee Yes, and...automation can do quite a lot, and so helps often.  Bundled with the REST API and many problems can be solved.  There is room to improve and this article shows the team is doing so...We just gotta be patient for some of the requests to be considered as there are lots of great ideas out there.  Thanks!

Simeon Ross Atlassian Team Jul 15, 2021

Hey @Bill Sheboy,

Can you run the edit variable action past me? Whats the use case here?

In terms of the lookup supporting all fields, the reason why it only supports what it does currently is performance. There are some fields that aren't part of the issue or that we need to fetch additional data from Jira for it to make sense. Until we can figure out a good way to handle this we've had to restrict it. You can imagine that if you did a search that brought back 100 issues and there were three fields that you accessed that needed more data, we'd need to hit Jira 300 times potentially, in a short window. That would make us not a good citizen :D 

Hi @Simeon Ross 

Thanks for your response!  Apologies for my wordy answer...  ;^)

I understand about the performance issues you note for lookup issues, and any fields that could be added would be appreciated.  I often note people asking about synchronizing things like start/due date and custom fields for parent/children...and although possible without having those fields in the lookup, rules would be simpler and shorter if the fields were present.

For edit variable, I can think a few use cases, including: improved clarity, shorter rules, accumulators, performance, and working around function limitations

  • Improved Clarity: There is an edge case/work-around for created variable edit, which allows updating a variable inside of a branch, as described in this article.  This only works for branches on one-and-only-one-issue, so the branch in-lines (or so I understand).  Thus it isn't an edit...it is actually a re-creation of the variable at the same scope.  Having an edit would help people understand the distinction.  Of note, I do not believe this branching/update technique works for multiple-issue branches; they execute asynchronously, so any variable changes (create or edit) are lost when the execution goes out of scope...right?
  • Shorter rules: Without edit variable, a work-around is to use multiple created variables to build up pieces of business problem answer, and then combine them later.  In some cases, the rule could become too long to implement by exceeding the maximum number of components.  Edit variable could help reduce that issue, and improve rule clarity by reducing "working variables" of extra created variables.
  • Accumulators: With edit variable, a value which needs to be accumulated across several issues could require just one variable, rather than multiple variables and multiple lookups and branches.  (please see Shorter rules and Performance)
  • Performance: One work-around for no edit variable is to update an issue field and then perform a re-fetch.  This greatly slows down a rule execution...and possibly causes unintended consequences/side-effects.  Having edit variable would eliminate the need for such a work-around.
  • Working around function limitations: My experience thus far is rarely can created variables be used as function parameters or with some of the math operators.  Sometimes this can be resolved by using multiple variables to progressively build up an answer; sometimes there is no solution to a specific problem.  Solving the use of variables in functions is beyond the scope of your question, but I do see edit variable making it easier when work-arounds with multiple variables would work.

Thanks again for the work the team is doing to help!

Best regards,
Bill

@Sam Harding This is great! In my use case, I'm using this to create a new Story for each label applied to an Epic. However, I can't seem to figure out how to add subtasks to each of those new Stories. 

It would be really convenient to have another branch available so I can use the for Most Recently created issue type of branch. 

 

I get this error "Can't branch rule as it requires issues to have been previously created by this rule. More than likely you have not yet created an issue or the issue(s) were created in an another 'If' block or branch - these would then not be visible outside of that block/branch."

Hi @Brian Eschen -- Welcome to the Atlassian Community!

You may want to consider posting your request as a new question with an image of your rule and the audit log.  That will give the community more visibility and context to provide you suggestions.  Thanks!

Best regards,
Bill

Hi @Bill Sheboy I did that here. Looks like I'm blocked by AUT-247

Like Bill Sheboy likes this
Simeon Ross Atlassian Team Jul 21, 2021

@Brian Eschen , the description of AUT-247 does have a suggested work around if that helps at all.

Darryl Lee Community Leader Jul 21, 2021

So hey @Simeon Ross - will we ever see this feature ported to Automation for DC/Server?

We recently got approval to purchase Automation for Server, and one of the "selling" points is that if we start moving various workflow customizations to Automation, that might ease the eventual transition to cloud.

Thanks.

Simeon Ross Atlassian Team Jul 22, 2021

Hey @Darryl Lee, that isn't something I can answer I'm afraid. However, I've pinged the server team and asked them to provide you an answer :)

Like # people like this

Hi @Sam Harding @Simeon Ross 

Is it expected that advanced branching should work to iterate over a list of issue links? I have posted a question here with the error I got.

Sam Harding Atlassian Team Aug 02, 2021

Hi @Julia Foden 

The feature did not cover issue links, but we have just rolled out an update that now allows issue to be used with the feature. Thanks for the feedback with your error information!

Cheers

Sam

Comment

Log in or Sign up to comment
TAGS
Community showcase
Published in Jira Automation

New to Jira Automation - goodbye Cron (sort of), hello new project created trigger, new additions to

Hey Everyone! Simeon from the Automation team here. I'm delighted to share some new features and improvements that we are shipping to Jira automation (Cloud only). Firstly, @Sam Harding&nbsp...

340 views 3 9
Read article

Community Events

Connect with like-minded Atlassian users at free events near you!

Find an event

Connect with like-minded Atlassian users at free events near you!

Unfortunately there are no Community Events near you at the moment.

Host an event

You're one step closer to meeting fellow Atlassian users at your local event. Learn more about Community Events

Events near you