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?

3 answers

1 votes
Nick Menere Community Champion 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!

 

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

 

You can also combine the two:

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

That works for me.

Thanks a lot!

0 votes
Ignacio Pulgar Community Champion Dec 22, 2016

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

Suggest an answer

Log in or Join to answer
Community showcase
Teodora [Botron]
Published Thursday in Marketplace Apps

Jira Inferno: The Nine Circles of Jira Administration Hell

If you spend enough time as a Jira admin - whether you are managing a single, mid-sized instance, a large enterprise one or juggling multiple instances at once - you will eventually find yourself in ...

285 views 0 12
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
Atlassian Team Tour

Join us on the Team Tour

We're bringing product updates and pro tips on teamwork to ten cities around the world.

Save your spot