Validating that Time have been logged before closing

I'm new to Jira and I'm trying to figure out how to make sure time have been logged at least 1 minute. So, if Time Spent = "0" OR NULL it should pop-up a message and prohibit to close the issue. I'm not a programmer :/

Jira Server 7.3.4 with Script Runner


1 answer

1 accepted

Hey there Francis,

I think I can help you out with this!

Follow these steps:

  • So first what you're going to need to do is open the workflow of the project that you would like this validation to function on. 
  • Then hit the edit button and switch to a diagram view.
  • Now, click on the transition in which you would like this validation to take place (in your case I assume you want the transition just before your "Close" or "Done" status).
  • After clicking the transition, a pop-up box should appear to your right. In that box click the Validators link.
  • From there, click "Add Validator"
  • Select a Script Validator and hit "Add"
  • Then click Simple Scripted Validator
  • Once there, add a note such as "Require Time-Spent" or something like that suites your uses. Then put this short script into the Condition window:
def timeSpent = issue.getTimeSpent()

timeSpent>=60000 && timeSpent != null

          and the Error Message "Error: There has been no time spent           on this issue!" But leave the Field box blank.

  • Time-spent is stored in milliseconds, so if you are looking for at least 1 minute you'd need to ensure that time-spent is at least equal to 60000 milliseconds. That's the purpose of the last line in the code block.
  • From then you can finish creating the validator and publish your workflow. 

If I'm following your question correctly, this should do the trick.

Let me know how it goes!


Suggest an answer

Log in or Sign up to answer
Community showcase
Posted yesterday in United States

Topic Tuesday: What's your favorite topic?

Good morning All, Our goal is to get you into the habit of while enjoying your favorite morning drink you are checking the NOVA "space" for topics and comments. Your input is really needed and...

36 views 4 0
View post

Atlassian User Groups

Connect with like-minded Atlassian users at free events near you!

Find a group

Connect with like-minded Atlassian users at free events near you!

Find my local user group

Unfortunately there are no AUG chapters near you at the moment.

Start an AUG

You're one step closer to meeting fellow Atlassian users at your local meet up. Learn more about AUGs

Groups near you