Hey Guys
I'm trying to do a calculation in jira that only includes business hours, but I can't seem to crack the nut. I'm right now using the "JMCF time in status" functionality with a field that just states the raw time. Then i have another field where i'm trying to use a groovy script to show <one thing> if time is <= 8 working hours else <another thing> is that at all possible or should I take another approach?
The script that i'm currently using is below - it works fine except that it takes raw hours and not working hours.
import com.atlassian.jira.component.ComponentAccessor
def customFieldManager = ComponentAccessor.getCustomFieldManager()
def field = customFieldManager.getCustomFieldObject(00001);
def value = issue.getCustomFieldValue(field);
if (value < 28800) return "one thing";
else return "another thing";
Hope you can help me crack the nut - thanks
Hi Jesper,
you simply cannot use the Time in Status custom field for that, since that custom field type has _no idea_ what "business hours" means. This is actually a complicated problem: the time spent in a particular status is really the time that elapsed between the moment the issue entered the status and the moment it left the status. Calculating the absolute duration is easy, but what about business time? That would require knowing exactly which day is a business day (excluding weekends and holidays), and also when the business day starts and when it ends. Not to mention, this could be different for different users, and it's also dependent on the timezone of the user, etc.
So if you know exactly how to calculate this duration, you can indeed create a Calculated Duration custom field, but you'll need to implement the algorithm yourself based on your own definition of business time.
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.