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

Next challenges

Recent achievements

  • Global
  • Personal


  • Give kudos
  • Received
  • Given


  • Global

Trophy case

Kudos (beta program)

Kudos logo

You've been invited into the Kudos (beta program) private group. Chat with others in the program, or give feedback to Atlassian.

View group

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

"Error: Field Time Spent is required" when closing an issue

Hello everyone!

We are trying to track time and made the "Time tracking" field mandatory to close an issue. The thing is, even if you do enter the time data, when you try to close the issue it fails with with the error "Field Time Spent is required", how can this be? and how can we fix it?.

Thanks so much!

3 answers

Hi @Facundo Colella ,

I guess the condition was set in such a way that even though the spent is filled, it should be changed during the transition.

So once recheck the comdition.


Exactly what did you do to make the "Time Tracking" field mandatory?

Did you change the Field Configuration to make "Log Work" required instead of optional? Or are you using a Validator in the workflow transition for closing the issue to ensure the field is not empty?

Hi @Ravya Mutyala _Appfire_ and @Trudy Claspill and thank you for your answers and your time.
We made a change in our approach and used a validator on the "Resolved to Closed" transition with the following: 

But now it won't even ask if the field is set or not. We've also tried this:
issue.timeSpent != null && issue.timeSpent != ''

Just to be absolutely sure, but maybe we are going the wrong way.
What we want actually is to make it mandatory to haver the time logged before closing an issue.
Thank you!

@Facundo Colella 

Are you trying to confirm that time has been logged against the issue at some point prior to the transition?

Or are you trying to confirm that more time is logged during the transition?

Or are you trying to establish a rule that requires time to be logged during the transition only when there has not been any time logged previously?

Hi Trudy,

It is actually more simple, what we really need, is to forbid an issue from being closed if there is no time logged for it, doesn't matter when the time was logged, you just shouldnt be able to close it without some time logged.

Thank you!

Our Jira instance doesn't include any add-ons that allow us to incorporate code into Validators. We just have basic Validator functionality available so I'm not able to experiment with the solution you've tried.

The trick is to ensure your Validator is looking at data stored in the issue already, versus looking at changes being made to the issue during the transition. Time Spent is an unusual field in that there is the Time Spent field that you could be filling in when making the transition (adding more Time Spent to the issue) and there is also the accumulated Time Spent recorded for the issue. What you really need to check is the accumulated Time Spent. What might be happening is that it is trying to validate that more data is being entered for Time Spent during the transition.

Unfortunately I don't have the tools/apps necessary in my JIRA instance to figure out how to do what you want. At another employer I had access to Adapativist's ScriptRunner for JIRA, which might be a tool that could help. I recall that we could run Groovy scripts using that tool, and look at other information already recorded in the issue.

Hello Trudy,

Thank you for your insight, I'll look into it, don't really know how to target the correct field if that was indeed the case, but I'll investigate about it.

Thanks again for your help!

I'm not sure if there is an actual field that stores the total time spent, or if that is calculated in real time based on the individual Work Logs.

Like Facundo Colella likes this

this code works fine.


import com.atlassian.jira.issue.Issue
import com.atlassian.jira.issue.MutableIssue
import com.opensymphony.workflow.InvalidInputException

def mIssue = issue as MutableIssue

def currentWorklog = mIssue.getModifiedFields().get("worklog")

if ( !currentWorklog ) {
throw new InvalidInputException("Time Spent must be logged when issues status updated")


Suggest an answer

Log in or Sign up to answer
Site Admin
Community showcase
Posted in Jira Software

Presenting the "Best of 2020" Jira Software roundup!

Catch up with Atlassian Product Managers in our 2020 Demo Den round-up! From Advanced Roadmaps to Code in Jira to Next-Gen Workflows, check out the videos below to help up-level your work in the new ...

7,142 views 8 28
Join discussion

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