I am trying to track how much time issue spends in status "in progress" and transitions to "Done" by automatically updating "time spent".
Idea is to have "time spent" start tracking as soon as issue will leave "To do" to "In Progress" and finishes tracking as soon as status changes to "Done" and automatically updates the field "time spent".
Keeping in mind that it syncs with before applied 5 days and 8 hours of working regime in Jira.
Is it possible ?
We are using jira standard cloud version and jira classical software project.
Doing something like this is quite easy when you use scripting (both on server or cloud). This information is stored in the change history on an issue which can be fetched both by Jira Java API as well as REST API.
In case you are on server and have ScriptRunner then this script will help you in getting the change history like when the status changed?
In case you are on cloud (which is my guess) then using either ScriptRunner for Jira on Cloud or the built in Automation you can call Jira REST API to fetch the change history. I would prefer using ScriptRunner as writing a groovy script is easier, a bit more readable and can handle complex cases. In both cases you need this end point.
JIRAURL/rest/api/3/issue/{{issue.key}}?expand=changelog
Let us say you want to do it using Automation rules, then when you call this end point. You will get a response JSON back in a smart value which you can access like this.
{{webhookResponse.body.changelog.histories}}
Now if you log this smart value you will get the json of the histories part of all the change histories. Now you can further iterate over those list of items in the change histories.
{{#webhookResponse.body.changelog.histories}}
ID: {{id}}
Created: {{created}}
{{#items}}{{fromString}} - {{toString}} {{/}}
{{/}}
This will give you all the items in the change log like this.
ID: 18206
Created: 2021-01-02T17:11:59.730+0000
To Do - In Progress
ID: 18152
Created: 2021-01-01T16:40:30.859+0000
To Do - In Review
Going back to your requirement, once you know how to fetch a change history, then you can perform some calculations on the dates for specific field changes.
The second part of your requirement was to log work. There is an action to do that or you can do that using REST API.
I hope this will help you, it is a bit complex but lot of fun :)
Ravi
..btw you can't auto fill a field but can log work using automation.
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
Hi @Ravi Sagar _Sparxsys_
Thanks for your great comment.
Could you help me how can I get the fromString value for the issue key?
I tried many things and couldn't get it.
{{#webhookResponse.body.changelog.histories.items.key}}
{{fromString}}
{{/}}
{{#webhookResponse.body.changelog.histories.items.field.key.fromString}}{{/}}
{{#webhookResponse.body.changelog.histories.items.field}}{{/}}
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
Adding onto what @Nic Brough -Adaptavist- suggests for trying this with automation, you may want to add a couple of custom fields to make this easier, and then increment time spent based on those. For example...
Best regards,
Bill
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
Hello @Kirill Gutmann
As an alternative solution, you can try Time between statuses by SaaSJet, which is an Atlassian marketplace vendor.
This add-on tracks transition time between statuses (e.g. from "in progress" to "done"). It also helps to set such calculation conditions as first/last transition and to/from status.
I hope, you find it helpful
Best regards, Mariana
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
Hi @Kirill Gutmann ,
As an alternative, you can try Status Time app developed by our team. It provides reports on how much time spent in each status as well as status entry dates and status transition count. Report can be exported as CSV, so that you can use external tools like Microsoft Excel or Google Spreadsheet to process the exported data.
Once you enter your working calendar into the app, it takes your working schedule into account too. That is, "In Progress" time of an issue opened on Friday at 5 PM and closed on Monday at 9 AM, will be a few hours rather than 3 days. It has various other reports like assignee time, status entry dates, average/sum reports(eg. average in progress time per project).
Here is the online demo link, you can see it in action and try.
If you are looking for a free solution, you can try the limited version Status Time Free.
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
You'll need one of the scripting or automation apps to do this, and it won't work quite the way your describe.
Cloud does not support "pre-fill" properly, there's no way for an app to inject the required code. The best you can do is pre-calculate and fill in a custom field during an action such as edit or transition.
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
Pre-calculating you mean, estimating on our own and posting our estimation to "time spent" ?
Approx. like this:
Auto time spent:
{
"update": {
"worklog" : [
{
"add": {
"timeSpent" : "6m"
}
}
]
},
"fields": {
"timetracking": {
"originalEstimate": "10",
"remainingEstimate": "5"
}
}
}
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.