Forums

Articles
Create
cancel
Showing results for 
Search instead for 
Did you mean: 

Delete worklogs per automation rule

Karin_Gleichauf
Contributor
November 15, 2022

Hi,

is there a possibility to delete worklogs per automation rule?

I wrote automation rules to sum up Original Estimates, Time Spent and Remaining Estimates of tasks to their parent Epics.

There is a problem when a worklog of a task is edited, e.g. the used had logged 30h instead of 30m and corrected this later. Then it is not possible to edit the Time Spent on Epic directly per automation. So I thought there might be the solution to delete the worklog on the epic and sum up the total Time Spent of the tasks again.

Best regards

Karin

1 answer

1 accepted

0 votes
Answer accepted
Alex Koxaras _Relational_
Community Champion
November 15, 2022

Hi @Karin_Gleichauf 

You could do that using REST API:

DELETE /rest/api/3/issue/{issueIdOrKey}/worklog/{id}
Karin_Gleichauf
Contributor
November 15, 2022

Hi @Alex Koxaras _Relational_ 

thank you very much. I'll test this.

I'm not at all experienced when it's about API. Are there any risks to do so?

Alex Koxaras _Relational_
Community Champion
November 15, 2022

The only risk I can think of, is to delete the wrong worklog. But if you find the proper id, I wouldn't expect you to encounter any problem. It's like performing the actual action. Having said that, if you look at the API you will read the necessary permissions:

Browse projects project permission for the project that the issue is in.

If issue-level security is configured, issue-level security permission to view the issue.

Delete all worklogs project permission to delete any worklog or Delete own worklogs to delete worklogs created by the user,

If the worklog has visibility restrictions, belongs to the group or has the role visibility is restricted to.

Karin_Gleichauf
Contributor
November 22, 2022

Hi @Alex Koxaras _Relational_ ,

thanks a lot. Unfortunately I'll have to postpone this due to other urgent issues.

But could you please tell me how to detect the correct worklog-ID in an automation rule? Would a worklog in my live-system be affected when I tested with a copied issue in my sandbox, are the IDs identical?

Alex Koxaras _Relational_
Community Champion
November 23, 2022

Hi @Karin_Gleichauf 

Run a /rest/api/3/issue/ request on any issue that has a worklog:

/rest/api/3/issue/KEY-XXX

and search the response for that specific worklog. Under field "worklogs" you should search for that specific worklog ID:

"worklog": {
"startAt": 0,
"maxResults": 20,
"total": 1,
"worklogs": [
{
"self": "https://koxaras.atlassian.net/rest/api/3/issue/10701/worklog/10057",
"author": {
"displayName": "Alex Koxaras",
"active": true,
"timeZone": "Europe/Athens",
"accountType": "atlassian"
},
"displayName": "Alex Koxaras",
"active": true,
"timeZone": "Europe/Athens",
"accountType": "atlassian"
},
"created": "2022-09-13T17:35:48.095+0300",
"updated": "2022-09-13T17:35:48.095+0300",
"started": "2022-09-13T12:35:45.309+0300",
"timeSpent": "5h",
"timeSpentSeconds": 18000,
"id": "10057",
"issueId": "10701"
}
]
}

Suggest an answer

Log in or Sign up to answer
DEPLOYMENT TYPE
CLOUD
PRODUCT PLAN
PREMIUM
PERMISSIONS LEVEL
Product Admin
TAGS
AUG Leaders

Atlassian Community Events