Automation - Add timestamp to custom field

Penry John August 23, 2022

I added a custom field and now want to create an automation that will timestamp it when I move from one column to the next:

My automation so far:

When: Issue Transitioned    FROM To Do       TO In Progress

Edit Issue > More options

{

     "Custom Field Name_10424" :

}

Is this the right way to do it? I did not see custom fields under the Choose fields to set... drop down. If I need to code under More Options, what is that code?

I appreciate ya!

5 answers

1 accepted

0 votes
Answer accepted
Trudy Claspill
Community Leader
Community Leader
Community Leaders are connectors, ambassadors, and mentors. On the online community, they serve as thought leaders, product experts, and moderators.
August 23, 2022

Hello @Penry John 

Welcome to the community.

When you say you want the custom field timestamped, so you mean you want to store the date/time of the transition in that field?

If you want to set a field value in your automation, and assuming that it is the custom field that you need to set, then yes, you will need more code in your More Options section. This document provides guidance on advanced editing of custom fields in Automation Rules using JSON.

https://support.atlassian.com/cloud-automation/docs/advanced-field-editing-using-json/

We need some additional information to provide you with more advice.

What is the data type of the custom field? You would have had to select this when making the custom field.

Is "Custom Field Name_10424" the name that you gave to the field?

Penry John August 24, 2022

Thank you for your response. Hopefully, the answers below help clarify

Correct, I do want the date/time stored in this field when an issue moves FROM To Do TO In Progress

  • Data Type - Date Time Picker
  • Custom Field ID - 10424
  • Custom Field Name - Cycle Time - Start

Looking at the link I see where I could set a custom field with a fixed timestamp but not one that says NOW.

My current JSON looks like this

{

"Custom Field Name_10424": {now}

}

 

Thanks again for your response!

David Freitez
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.
August 24, 2022

Hi @Penry John

If you are going to use it this way,  it should be double {}, like this {{now}}

Trudy Claspill
Community Leader
Community Leader
Community Leaders are connectors, ambassadors, and mentors. On the online community, they serve as thought leaders, product experts, and moderators.
August 24, 2022

And it should be in quotes.

Also you need to provide the actual field Name or the field ID, and I believe you need to provide the "fields" section in the JSON or the "update" section. Here are three examples that should work.

{ 
"update": {
"Cycle Time - Start": {
"set": "{{now}}"
}
}
}

 


{
"fields": {
"customfield_10424": "{{now}}"
}
}

 

{
"fields": {
"Cycle Time - Start": "{{now}}"
}
}

You can also use the Log Action to log values into the Rule Audit Log if you want to see what values the Rule is working with.

Like # people like this
1 vote
David Freitez
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.
August 23, 2022

Hi @Penry John

First of all, welcome to the Atlassian community.

Regarding your question, Automation grants the use of Smart Values.

In your case, it will fit the use of {{now}}

Here is documentation so you can check further regarding the format you need:

https://support.atlassian.com/cloud-automation/docs/jira-smart-values-date-and-time/

Also, you don't need to use the advance options, you can use the smart value like in the following example:

Capture1112.JPG

Kindly review my comment and let me know if you need further help.

Regards,

David
ServiceRocket.

Penry John August 24, 2022

Thank you for your response.  

In the Choose fields to set I do not see my custom field I created. Is there a way to import that into that drop down? 

I assumed that I will need to do advanced field editing to Edit issue.

David Freitez
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.
August 24, 2022

Hi @Penry John 

It should appear there by name, if not, try to check on the custom field context to check if there is available a context for the project.

If you want to use the Advance field editing, it should be:

{
"fields": {
"customfield_10424": "{{now}}"
}
}

If for some reason, it gives an error on the log, try to check the proper format for now, you can check that on this document:

https://support.atlassian.com/cloud-automation/docs/jira-smart-values-date-and-time/

0 votes
Bloompeak Support
Marketplace Partner
Marketplace Partners provide apps and integrations available on the Atlassian Marketplace that extend the power of Atlassian products.
September 18, 2022

Hi @Penry John

As an alternative, you can try Status Time Reports app developed by our team. It mainly provides reports and gadgets based on how much time passed in each status.

Here is the online demo link, you can see it in action and try without installing the app.

  • This app has a dynamic status grouping feature so that you can generate various valuable reports as time in status, time in assignee, status entry dates and status counts, cycle time and lead time, average/sum reports by any field(e.g. average in progress time by project, average cycle time by issue creation month).
  • You can search issues by Project, Issue Type, Status, Assignee, Issue Creation/Resolution Date(and any other Date field) and JQL Query.
  • Status durations are calculated according to the working calendar you define. 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.
  • You can set different duration formats.
  • You can export reports in CSV file format and open them in MS Excel.
  • You can also add this app as a gadget to your Jira dashboards and reach “Status Time” from Issue Detail page.
  • You can enable/disable access to Status Time reports&gadgets and Issue Detail page per project, users, groups or project role.

If you are looking for a free solution, you can try the limited version Status Time Free.

Note: If you are interested in cycle and lead time, you can have a look at the article below.

Cycle Time and Lead Time in Jira: Productivity Measurement with Two Critical Parameters

Hope it helps.

0 votes
Emre Toptancı _OBSS_
Marketplace Partner
Marketplace Partners provide apps and integrations available on the Atlassian Marketplace that extend the power of Atlassian products.
September 9, 2022

Hello @Penry John

If you are OK with using a marketplace app for this, our team at OBSS built Time in Status for this exact need. It is available for Jira Server, Cloud, and Data Center.  

Time in Status mainly allows you to see how much time each issue spent on each status and on each assignee

tisCloud_StatusDuration_LeadTime_with Estimates.png  tisCloud_AssigneeDuration.png     

The app also have 4 types of date reports that show the First/Last transition date Ta/From a status.

tisCloud_FirstTransitionToStatusDate_Report.png

The app calculates its reports using already existing Jira issue histories so when you install the app, you don't need to add anything to your issue workflows and you can get reports on your past issues as well. It supports both Company Managed and Team Managed projects.

Time in Status reports can be accessed through its own reporting page, dashboard gadgets, and issue view screen tabs. All these options can provide both calculated data tables and charts.

And the app has a REST API so you can get the reports from Jira UI or via REST.

Gadget_AverageStatusDurationByComponent.png  tisCloud_StatusDuration_LeadTime_Chart.png

Using Time in Status you can:

  • See how much time each issue spent on each status, assignee, user group and also see dates of status transitions.
  • Calculate averages and sums of those durations grouped by issue fields you select. (For example, see average InProgress time per project and per issue type.)
  • Export your data as XLS, XLSX, or CSV.
  • Access data via REST API. (for integrations)
  • Visualize data with various chart types.
  • See Time in Status reports on Jira Dashboard gadgets

https://marketplace.atlassian.com/apps/1211756/

EmreT

0 votes
Penry John August 25, 2022

Thanks for your help. The third suggestion worked the best.

 

{
"fields": {
"Cycle Time - Start": "{{now}}"
}
}

Suggest an answer

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

Atlassian Community Events