Using automation create a repeating pattern of stories for different teams all linked to same epic

Jonathan Parsons September 26, 2022

My problem statement is as follows:

I need a repeating pattern in which that requires 4x stories but these need to be created multiple time  for multiple teams and all of these stories link back to the same epic.

Whilst the descriptions, acceptance criteria, notes etc have the same value for each of the 4 stories there is a variance in that each teams stories have distinct value associated with them for the stories assigned to their backlogs being: 

  • Team, Component and Priority 

For each component there could be maximum 12 stories (4x priority = Highest, 4x priority = Medium and 4x priority = Lowest) or there could be just 4x if only one priority applies

The priority is set from epic component value e.g. Service (Primary), Service (Secondary), Service (Tertiary)

This is a repeated pattern. I could create very long automation rules that have many duplicate instances of 'Create a new story' but I'm sure that I could automate this more efficiently using a rule to call another rule or branching etc. BUT I can't fathom the right approach.

So basically at its simplest:

  • For a selected Epic "CP Foo"
  • for each Team Repeat the following linked to Epic "CP Foo"
    • Create Story 1 with Priority = Highest and Component = 'EKS'
    • Create Story 2 with Priority = Highest and Component = 'EKS'
    • Create Story 3 with Priority = Highest and Component = 'EKS'
    • Create Story 4 with Priority = Highest and Component = 'EKS'
    • Create same 4x stories if there exists Priority = Medium; and repeat if there exists Priority = Lowest etc.
    • End Repeat

I have proven out the rule for one team and one set of 4x user stories to ensure generation of story content is correct (see attached image). 

  • When: This is manually triggered 
  • Where IssueType = Epic 
  • If Epic Name starts with "CP Foo"
  • Then create a new Story 1 in Same Project where epic link is 'copy from trigger issue'
    • Set Summary, Description, Priority, Component, Fix Version, Notes and Acceptance Criteria 
  • Then create a new Story 2 in Same Project where epic link is 'copy from trigger issue'
    • Set Summary, Description, Priority, Component, Fix Version, Notes and Acceptance Criteria 
  • Then create a new Story 3 in Same Project where epic link is 'copy from trigger issue'
    • Set Summary, Description, Priority, Component, Fix Version, Notes and Acceptance Criteria 
  • Then create a new Story 4 in Same Project where epic link is 'copy from trigger issue'
    • Set Summary, Description, Priority, Component, Fix Version, Notes and Acceptance Criteria 
  • STOP RULE 

Screenshot 2022-09-26 180757.png

Any help, advice, direction would be greatly appreciated please?

1 answer

1 accepted

0 votes
Answer accepted
Bill Sheboy
Rising Star
Rising Star
Rising Stars are recognized for providing high-quality answers to other users. Rising Stars receive a certificate of achievement and are on the path to becoming Community Leaders.
September 26, 2022

Hi @Jonathan Parsons 

Step one: make it work.  Step two: make it "better".

You are on a good track that a long, simple rule could solve this, and you could do that with an advanced branch over a list of teams (either from the epic or from a created variable), and then use conditions on the component to add either 4, 8, or 12 stories per team.  That rule will be about 30 rule steps (components).

Once that works, you could try a shorter, more complicated rule.  I recommend saving your working rule before trying this with a copy of the rule.

  • Use nested list iterators to create a variable that has pairs of team|component values
  • Use an advanced branch to iterate over that variable, and split the pair values when needed to create the stories, setting their component and priority.  That rule will be about half as long.

Unfortunately it is not possible to nest branches within each other in rules to simplify writing this rule.  Maybe they will add that feature in the future.

And watch for this...rules like this which do a lot of work can run a long time.  That could lead to throttling, rule halting, and exceeding your execution time limits per hour.  Check the stats to observe what is happening.

Kind regards,
Bill

Jonathan Parsons September 27, 2022

Hi @Bill Sheboy 

Thanks for your quick response, positive feedback and suggestions on breaking down the work for my problem statement.

Working through the long simple route I pivoted away from use of teams and chose to iterate on the values in the Epic components field instead; of which I then implemented an advanced branch over that variable as suggested.

I have one outstanding issue at then end of this reply but this is where I went before I got to that:

  • So for the purpose of proving out the automation I have 3 component values on the Epic being: EKS (Primary), Landing Zone (Primary) & Networking (Secondary) - although final version these values will be have additional values such as EKS (Secondary) and so on..
  • The advanced branch iterates on a smart value {{componentName}} set by {{issue.components.name}}
  • Within the branch I have 4x re-usable user stories of which I dynamically transpose the {{componentName}} value inside part of the description, add to component fields making thus distinct stories.
  • Hence 3x components have created 12 distinct stories in the Epic

 

Screenshot 2022-09-27 190213.png

 

Screenshot 2022-09-27 190213.png

 


 

My next challenge was to find the correct index position of the component value to add to each story description and component

  • I had created a smart value variable {{componentIndex}} (with smart value = 0) and then set the property entity of this as {"val": {{componentIndex}} }. 

I then referenced this in each user story as follows

  • {{issue.components.name.get(issue.properties.prop_componentIndex.val)}}

BUT I could not for the life of me work out how to increment the componentIndex value by 1 to return the next index position using list 'get(foo)' to return the next component.name value in the list.

Then I realised that all I needed was to use the advanced branch smart value {{componentName}} instead as this was already being iterated. Dur!

As I type this I've yet to remove the now redundant 'Create Variable and Set Entity Property' components prior to start of the advanced branch

So a great result in the end, learning some tricky bits as I went :)

 


 

However I am unable to work out how to set the user story priority based upon the {{componentName}} value as iterating through the advanced branch (as per yellow circle in picture above)

For example:

  • EKS (Primary) or Landing Zone (Primary) would have a priority value = highest
  • Networking (Secondary) = medium
  • if there was a Tertiary = lowest

On the {{componentName}} I can't work out how to:

  1. parse/pattern match (or the see the correct equivalent function to do this) to identify 'Primary', 'Secondary' etc
  2. then set the user story Priority IssueType.

Its not clear what smart value properties Priority has ? Is it only {{issue.priority}} ?

Also I assume some JSON code is required but cannot see which automation component to use that would allow me to parse/pattern match for primary etc and also set the priority value.

IS this a combination of creating a smart value variable and set entity property - but if so how do you update this as the {{componentName} iterates in the advanced branch?

Any advice would be greatly appreciated please?

Bill Sheboy
Rising Star
Rising Star
Rising Stars are recognized for providing high-quality answers to other users. Rising Stars receive a certificate of achievement and are on the path to becoming Community Leaders.
September 27, 2022

First thing: well done figuring this one out!

Okay, you are on track with the approach of creating a variable and using that to set the priority.  Unfortunately, variables cannot be used in smart value, list filtering (which would make this easy.)

Just to confirm your use case, which of these applies:

(A) based on the epic's components, the SAME priority will be used for all of the stories, with the highest possible priority winning out
(B) each set of stories will have a potentially DIFFERENT priority based on the specific component accessed within the branch

For case (A), I would determine the priority before the branch, make a delimited list of priority|componentName pairs, and then split that for the advanced branch iterator, which will then assign within the branch by splitting apart the pair of priority and componentName.

For case (B)...two possible work-arounds inside of the branch are:

  1. use an if/else structure to check the branch's variable (component name) to then create a variable to set for priority, such as varPriority.
  2. create your varPriority variable in one step, using a string of replaceAll() calls to substitute the correct name.  For example...

{{componentName.replaceAll("EKS (Primary)", "Highest").replaceAll("Landing Zone (Primary)", "Highest")...

 

Once you have varPriority set, in the Create Issue action select the priority field and type in {{varPriority}} and the smart value will appear below the field.  Select it so it is used.

Please note: I believe you need to set the id value for priority to edit in this way, but perhaps try the name first to see if it works.

Jonathan Parsons September 28, 2022

Hi @Bill Sheboy 

Its use-case (B) where each set of stories (under the same epic) will have a potentially DIFFERENT priority based on the specific component accessed within the branch e.g.

  • Under Epic (foo): where component value = "EKS (Primary)"
    • implies create 4x stories ALL of which have priority value = "Highest"
  • Under Epic (foo): where component value = "Networking (Secondary)"
    • implies create 4x stories ALL of which have priority value = "Medium" 
  • etc.

With your proposed approach for (B)  

  1. use an if/else structure to check the branch's variable (component name) to then create a variable to set for priority, such as varPriority.

Q: How can this be done when you can't use if/else inside a branch? 

Should I create the following 'create variable' component before the advanced branch e.g.  

  • Variable Name = varPriority
  • Smart Value = [new list? = ] {{issue.components.name.replace("EKS (Primary)", "Highest").replace("Elastic (Primary)", "Highest").replace("Landing Zone (Primary)", "Highest").replace("Network (Secondary)", "Medium")}}
  • I'm not clear whether if not a new list is created, then does the above overwrite the original actual component list contents? 

Of course this means I'd need to code every different distinct component into the automation BUT if the advanced branch is iterating on the smart variable {{componentName}} inside the branch how can I iterate in parallel for the {{varPriority}} equivalent?

What I have noticed is that under Create Issue component the 'Priority' field does not seem to allow Smart Values to be entered :(

 

 

Bill Sheboy
Rising Star
Rising Star
Rising Stars are recognized for providing high-quality answers to other users. Rising Stars receive a certificate of achievement and are on the path to becoming Community Leaders.
September 28, 2022

My mistake: I recalled there was a hack that allowed creating the if/else and dragging it into a branch, but I just retested and that is not possible now.

 

For the second approach, no: create the varPriority variable inside of the branch.  You note that the priority can change by component.  If we assume the epic has multiple components the priority is dynamically determined inside of the loop.

The varPriority variable create would try to replace each possible component name to determine the priority.  But there should only be one match per component, and so only one priority value.

To use that value for the priority field in Issue Create...

  • type in the smart value, ignoring the dropdown values
  • the smart value will appear below the field
  • select the smart value below the field, and it will be used
Jonathan Parsons September 30, 2022

Hi @Bill Sheboy 

After getting my head around how the following assignment properties behaved; and using ID value as the replacement instead of priority name e.g. "Highest"

  • Variable Name assigned as: varPriority
  • Smart Value assigned as: {{issue.components.name.replace("EKS (Primary)", "10001").replace("Elastic (Primary)", "10001").replace("Landing Zone (Primary)", "10001").replace("Network (Secondary)", "10003")}}

Plus assigning {{varPriority}} to the Priority field as you stated - it all worked!!

I was able to copy the same process above but to identify & assign Jira Portfolio Teams through a custom value in the JSON script of each create issue.

Thank you so much for your help and guidance. A great result and learned alot more about the nuances of automation scripting

Like Bill Sheboy likes this
Bill Sheboy
Rising Star
Rising Star
Rising Stars are recognized for providing high-quality answers to other users. Rising Stars receive a certificate of achievement and are on the path to becoming Community Leaders.
September 30, 2022

Well done, and I was glad to help!

Suggest an answer

Log in or Sign up to answer
DEPLOYMENT TYPE
CLOUD
PRODUCT PLAN
PREMIUM
TAGS
AUG Leaders

Atlassian Community Events