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

Earn badges and make progress

You're on your way to the next level! Join the Kudos program to earn points and save your progress.

Deleted user Avatar
Deleted user

Level 1: Seed

25 / 150 points

Next: Root


1 badge earned


Participate in fun challenges

Challenges come and go, but your rewards stay with you. Do more to earn more!


Gift kudos to your peers

What goes around comes around! Share the love by gifting kudos to your peers.


Rise up in the ranks

Keep earning points to reach the top of the leaderboard. It resets every quarter so you always have a chance!


Come for the products,
stay for the community

The Atlassian Community can help you and your team get more value out of Atlassian products and practices.

Atlassian Community about banner
Community Members
Community Events
Community Groups

what exactly is this code doing and how does it relate to status to being no plan, late, or at risk?


This is for building the structure.

If (MATCH(issuetype, "Epic") ; If (MATCH(resolved,""); If (MATCH(JOIN#children{storystatus},"*NOPLAN*"); "{panel:bgColor=#ff5733}NEED PLAN{panel}"; MATCH(JOIN#children{storystatus},"*RED*"); "{panel:bgColor=#ff5733}LATE{panel}"; MATCH(JOIN#children{storystatus},"*YELLOW*") ; "{panel:bgColor=#ffc300}AT RISK{panel}"; "{panel:bgColor=#0cff00}ON PLAN{panel}"); "{panel:bgColor=#0cff00}COMPLETE{panel}" ) )


this is the Formula for variable story status

IF(issuetype != "Epic"; IF(!DEFINED(resolution); case( sprint; ""; "NOPLAN"; "/(?:,([^,]+)){2}/"; "RED"; "/(?:,([^,]+)){1}/"; "YELLOW"; "GREEN" ) ) )

1 answer

2 votes

Hi David,

Welcome to the community!

First I should mention it looks like this answer is tagged with Jira-cloud, but you are definitely on Server or datacenter.  On cloud you can't have one formula reference another.

Secondly, I've reformatted the code so it is easier to read but haven't changed it functionally.

If (MATCH(issuetype, "Epic") ; 
If (MATCH(resolved,""); 
If (MATCH(JOIN#children{storystatus},"*NOPLAN*"); "{panel:bgColor=#ff5733}NEED PLAN{panel}";
MATCH(JOIN#children{storystatus},"*RED*"); "{panel:bgColor=#ff5733}LATE{panel}";
MATCH(JOIN#children{storystatus},"*YELLOW*") ; "{panel:bgColor=#ffc300}AT RISK{panel}";
"{panel:bgColor=#0cff00}ON PLAN{panel}");
"{panel:bgColor=#0cff00}COMPLETE{panel}" ) )

Going line by line:

  1. checks if this row is an epic
  2. checks if the item has an empty resolution (i.e. it is not resolved)
  3. This is a bit complicated but essentially the second formula storystatus returns "NOPLAN", if the unresolved epic is not assigned to a sprint.  If this was at the initiative level we are checking that any epic directly underneath (what #children specifies) returns that string.
  4. if we don't find "NOPLAN", we check for "RED".  RED is returned by storystatus when the regex is matched. the regex is "/(?:,([^,]+)){2}/".  It looks like it is looking for at least 3 sections separated by 2 commas in the name of the sprint.  
  5. Yellow has a very similar regex, but we are looking for 1 comma in the sprint name, and we return YELLOW
  6. This line is the default return which gives us "ON PLAN", which is basically saying we didn't find RED, YELLOW, or NOPLAN in the underlying epics
  7. This line returns "COMPLETE" in a panel, and is only reached if the resolved match on line 2 returns false, but I would expect comparing any string to empty string would return true, so I'm not sure if this line ever executes.

Ultimately the Regular expressions are the hardest part to decode, but hopefully I've helped to point you in the right direction.  

I would expect there are much nicer ways to do what someone has tried to do here.  I'd start with our sample formulas documentation.


Suggest an answer

Log in or Sign up to answer