"Time Spent" cannot be used through Behaviour plug-in or JIRA Workflow Post Functions


Make "Time Spent" field required during transition from one state to another if Customer is ABC


System = Download JIRA (v6.0.1#6096-sha1:e4a48bd)

"Time Spent" field info according to https://<my_jira_instance>/rest/api/2/field

"id": "timespent",
"name": "Time Spent",
"custom": false,
"orderable": false,
"navigable": true,
"searchable": false,
"schema": {
"type": "number",
"system": "timespent"

SYMPTOM #1 - Behaviour plug-in

  1. Created behaviour and added "Time Spent" field
  2. Added the following script:
    log.warn ("Time Spent, please talk to me!" + getFieldChanged())
  3. Added condition for action (transition)

No "Time Spent" info in the atlassian-jira.log. Works for other system and custom fields.

SYMPTOM #2 - JIRA Workflow Transition

Transition Screen: during transition, enter or change values in any system or custom field without clicking OK - AJAX evnets are sent to server (according to atlassian-jira.log)

"Time Spent" - enter any value - NO events are sent to server

SYMPTOM #3 - JIRA Workflow Post Function

  1. Created my own "ABC Time Tracking" custom field and added it to the transition screen.
  2. Create -> Workflow -> View Post Functions
  3. Selct "Copy Value From Other Field"
  4. Source Field = "ABC Time Tracking"
  5. Destination Field = <not on the list>. The sum Time Spent doesn't count.

Please help and thanks in advance!

2 answers

0 votes

Hi Michael,

I see you're quite keen to get an answer to this query, having raised a support request and bug as well, so I went ahead and had a look into it.

As I think has been said on the issue / support case, we don't track field updates by firing off AJAX events whenever a field changes, the calls you see are to get options for drop downs, etc.

One suggestion regarding the Behaviour plugin approach: did you try adding the field as "timespent" rather than "Time Spent"? I've never used it as I said so I don't even know if it gives you a drop-down list or just a free text field to enter the field name. This question may be relevant: https://answers.atlassian.com/questions/164622/jira-workflow-validator-problem-required-field

I checked out using a custom workflow validator, and the data passed in included a comment, but couldn't see a reference to the time I just logged. It is at least possible to code up a workflow condition that will block a transition if the time spent field is empty, though. I just tried it out myself. Instructions on how to add a condition are here. Inside your plugin's condition-class that extends AbstractJiraCondition, the method should look something like this:


 public boolean passesCondition(Map map, Map map2, PropertySet propertySet) throws WorkflowException


    return(getIssue(map)).getTimeSpent() != null;


If you install the plugin, then add this condition to the relevant transitions of the relevant workflow, the transition will not show up unless time has been logged against the issue.

It's not exactly what you asked for (the field is required before the transition, not during and it just checks that something is set rather than added), but I hope that helps!


James (Atlassian)

James, thank you very much for looking into this. I will try it out and let you know.

Regarding Behaviour plugin, you can call a field by either a name or ID:
getFieldByName("Time Spent")

Suggest an answer

Log in or Sign up to answer
Community showcase
Published Jan 08, 2019 in Jira

How to Jira for designers

I’m a designer on the Jira team. For a long time, I’ve fielded questions from other designers about how they should be using Jira Software with their design team. I’ve also heard feedback from other ...

1,016 views 4 9
Read article

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