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

Next challenges

Recent achievements

  • Global
  • Personal

Recognition

  • Give kudos
  • Received
  • Given

Leaderboard

  • 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

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!

Aidan

Suggest an answer

Log in or Sign up to answer
TAGS
Community showcase
Published in Marketplace Apps & Integrations

Learn how to request and manage app requests in the Marketplace

G’day everyone! Super exciting news coming from the Marketplace. We have now fully rolled out the ability for end-users to submit app requests to admins directly from within the product! No longer ...

43 views 1 5
Read article

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