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

Earn badges and make progress

You're on your way to the next level! Join the Kudos program to earn points and save your progress.

Deleted user Avatar
Deleted user

Level 1: Seed

25 / 150 points

Next: Root

Avatar

1 badge earned

Collect

Participate in fun challenges

Challenges come and go, but your rewards stay with you. Do more to earn more!

Challenges
Coins

Gift kudos to your peers

What goes around comes around! Share the love by gifting kudos to your peers.

Recognition
Ribbon

Rise up in the ranks

Keep earning points to reach the top of the leaderboard. It resets every quarter so you always have a chance!

Leaderboard

Come for the products,
stay for the community

The Atlassian Community can help you and your team get more value out of Atlassian products and practices.

Atlassian Community about banner
4,637,710
Community Members
 
Community Events
196
Community Groups

How to change timespent with an automation rule?

I'm using JIRA Time Tracking and want to change timespent / timeestimate in an automation rule.

When using Edit Issue with the following JSON, i get the error message 'unknown field ignored' when the rule is executed:

{
   "fields": {
      "timeestimate": "0"
   }
}

How can I solve this?

6 answers

3 votes
Nick Menere
Rising Star
Rising Star
Rising Stars are recognized for providing high-quality answers to other users. Rising Stars receive a certificate of achievement and are on the path to becoming Community Leaders.
Dec 22, 2016

Hey Markus,

Thanks for using Automation for JIRA.

The time tracking fields aren't straight forward. The reason you are getting that message is the timetracking is a conglomerate field (represents multiple values) - timeestimate is just part of the parent field.

To change the estimate you have use the following format in advanced:

{
    "fields": {
        "timetracking": {
              "originalEstimate": "10",
              "remainingEstimate": "5"
        }
    }
}

 

I tested out with the following rule and it worked:

image2016-12-23 12:30:16.png

 

Hope this helps.

 

Cheers,
Nick

Thanks, that brings me forward one step in settinh original and remaining estimate.

I still cant set the Logged Work (timespent).

Error: Setting the Time Spent directly is not supported. (timetracking)

Thanks for help!

 

andreas
Rising Star
Rising Star
Rising Stars are recognized for providing high-quality answers to other users. Rising Stars receive a certificate of achievement and are on the path to becoming Community Leaders.
Dec 22, 2016

Hi Markus,

You can add worklog with the following JSON: 

{
  "update": {
    "worklog" : [
      {
        "add": {
          "timeSpent" : "6m"
        }
      }
    ]
  }
}

Please ensure that the "Log Work" field is on the appropriate edit screen in JIRA.

Here's an example rule:

Project automation - Your Company JIRA 2016-12-23 16-20-17.png

Cheers,

  Andreas

 

andreas
Rising Star
Rising Star
Rising Stars are recognized for providing high-quality answers to other users. Rising Stars receive a certificate of achievement and are on the path to becoming Community Leaders.
Dec 22, 2016

You can also combine the two:

{
"update": {
    "worklog" : [
      {
        "add": {
          "timeSpent" : "6m"
        }
      }
    ]
  },
    "fields": {
        "timetracking": {
              "originalEstimate": "10",
              "remainingEstimate": "5"
        }
    }
}

That works for me.

Thanks a lot!

@Nick Menere thanks for your answer.

 

I'm also using JIRA automation and have configured it as to set the remaining estimate to 0 once the issue transitions to a certain state.

 

For that I use the following the "Edit field" action and in the "advanced" section I pass on following JSON:

{
   "fields": {
    "timetracking": {
      "remainingEstimate": "0"
    }
  }
}

 

However this updates both the remaining and the original time estimate – while it's important for us the original stays in tact.

Any suggestions on how to change only the remaining estimate?

 

Thanks in advance,

Anthony

Nick Menere
Rising Star
Rising Star
Rising Stars are recognized for providing high-quality answers to other users. Rising Stars receive a certificate of achievement and are on the path to becoming Community Leaders.
Oct 25, 2018

Hey Anthony,

 

to do this you will need to set the original to the current value (weird but that is how the Atlassian Rest api works):

{
   "fields": {
    "timetracking": {
      "remainingEstimate": "0",
"originalEstimate": "{{timetraking.originalEstimate}}"

    }
  }
}

Hope that helps,

 

Cheers,

Nick

Like Elie Théocari likes this

Hello @Nick Menere,

Actually, when I try to do this on issue with 2 decimals (i.e original estimate = 0.61h), it converts it to a 1 decimal value (0.6h). Do you know if there's a way to have the exact same value?

Please do not ask why we are using such accuracy in our estimation, I'm already fighting with my management for that :)

Btw, there is a typo in your answer : 

timetraking.originalEstimate -> timetracking.originalEstimate

Thanks & Regards.

Nick Menere
Rising Star
Rising Star
Rising Stars are recognized for providing high-quality answers to other users. Rising Stars receive a certificate of achievement and are on the path to becoming Community Leaders.
Jan 14, 2019

Apologies Sébastien, this reply slipped through.
I believe this is Jira that is rounding this.

Can use the value:

{{#debug}}
{
"fields": {

    "timetracking": {
      "remainingEstimate": "0",
"originalEstimate": "{{timetracking.originalEstimate}}"

    }
  }
}
{{/}}

That should tell us whether we are passing the right value and Jira is doing the rounding. This will log the value in the audit log.

If Jira is doing the rounding we may have to resort to converting this to minutes but that will not be pretty. E.g.

{{#debug}}{{#=}}{{timetracking.originalEstimate.replace("h", "* 60 +").replace("m", "")}}{{/}}m{{/}}

 

(I haven't tested the above.....)

Hope that helps.

 

Cheers,

Nick [Automation for Jira]
Co-founder

Hello, @Nick Menere  @Markus Döring  I want automation for JIRA rule to update a field "efficiency" with the value  ORIGINAL ESTIMATE - TIME SPENT. Can anyone help here?

Regards

Priyanka 

Like Suporte weKnow likes this
1 vote
Alexander Pappert
Rising Star
Rising Star
Rising Stars are recognized for providing high-quality answers to other users. Rising Stars receive a certificate of achievement and are on the path to becoming Community Leaders.
Sep 04, 2018

Hi,

I need to remove the logged work.

 

Is there a similar Option to set it to zero?

{ "update": { "worklog" : [ { "add": { "timeSpent" : "6m" } } ] } }

 

{ "timeSpent" : "0m" } did not work

also { "timeSpent" : "-6m" } did not work

I created a template rule for adding LogWork, but the actor is specified, and every time this rule is triggered, LogWork is written to the actor and not to {{initiator.key}}.
How can I change the value of the actor field to {{initiator.key}}, or currentUser()?

Hi @Nick Menere ,

I created my rule as descripted above:

{
   "fields": {
    "timetracking": {
      "remainingEstimate": "0",
"originalEstimate": "{{timetracking.originalEstimate}}"

    }
  }
}

 But I still get the same message like @Markus Döring
 'unknown field ignored' when the rule is executed.

grafik.png

here is what I did:

{
"fields": {
"timetracking": {
"originalEstimate": "{{issue.timetracking.originalEstimate}}",
"remainingEstimate": "0m"
}
}
}

0 votes
Ignacio Pulgar
Rising Star
Rising Star
Rising Stars are recognized for providing high-quality answers to other users. Rising Stars receive a certificate of achievement and are on the path to becoming Community Leaders.
Dec 22, 2016

Do you mean through a JIRA Service Desk automation rule, or through calling the API?

Suggest an answer

Log in or Sign up to answer
TAGS
AUG Leaders

Atlassian Community Events