OBJECTIVE
Make "Time Spent" field required during transition from one state to another if Customer is ABC
SETUP
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
log.warn ("Time Spent, please talk to me!" + getFieldChanged())
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
Please help and thanks in advance!
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:
getFieldById("timespent")
getFieldByName("Time Spent")
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:
@Override 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!
Regards,
James (Atlassian)
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
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.