How to create a custom field that counts the days that have passed since a task has expired in Jira?

Héctor Daniel Reyna Bermúdez January 8, 2021

I'm trying to create a custom field where the business days (not Saturday and Sunday) elapsed since the due date of a task are counted but I can't find where to enter the formula for this to work.

 

Please guide.

2 answers

0 votes
Nic Brough -Adaptavist-
Community Leader
Community Leader
Community Leaders are connectors, ambassadors, and mentors. On the online community, they serve as thought leaders, product experts, and moderators.
January 9, 2021

People who ask for a field like this often fall into a bit of a minefield, and I would encourage you to think it through before you try to implement anything like this.

At first look, the simple human description of "number of days that have passed since" (or "number of days to", or other variants with hours, weeks, minutes, and other dated milestones) are instinctively very simple.  There is nothing wrong with thinking in that way, it's normal for humans, and also very useful.

But computers store static data, not dynamic.  The number of minutes that have passed since you asked the question, you got a reply, I replied, and you read each answer has changed every elapsed minute.

The field you could call "minutes passed since someone responded to this post" can only hold valid data for 60 seconds.  You would need to update it every 60 seconds to keep it valid.

I've used minutes to emphasise that a "time since" field is either wrong or imposes massive load in updating it a LOT, but the principle is the same whether it's seconds or years - do not try to do this with the data.

Very broadly, you have two options:

  • Recalculate a stored value every X seconds/minutes/hours/etc
  • Read a static piece of data, and base a calculation on it and the current time

Obviously, the first option is utter rubbish.  Logically, it works, but in real life, it won't scale beyond a couple of thousand items if you choose minutes, and even if you go for weeks, I'd say you need to be below 10,000 issues.

The second one requires some form of injection of a dynamic display.  You'll need to find or write an app that can look at a date/time field and calculate a new number from it to display.

0 votes
Kristján Geir Mathiesen
Community Leader
Community Leader
Community Leaders are connectors, ambassadors, and mentors. On the online community, they serve as thought leaders, product experts, and moderators.
January 8, 2021

Hello @Héctor Daniel Reyna Bermúdez  and welcome to the Community!

I believe you need a plugin to achieve this, like Jira Misc Custom Fields. With it, you should be able to create a custom field and whip up a formula to calculate this. Not totally sure about minus the weekends though.

Btw, I am not affiliated with Innovalog (the vendor).

HTH,
KGM

Suggest an answer

Log in or Sign up to answer