Create
cancel
Showing results for 
Search instead for 
Did you mean: 
Sign up Log in
It's not the same without you

Join the community to find out what other Atlassian users are discussing, debating and creating.

Atlassian Community Hero Image Collage

Get the close date to Custom field

Hello,

I would like to capture the issue closed date and time to a custom field, I have created the custom field as Date and time picker and added the post function to write the date to the custom field.

have added the groovy and getting the Close date but its showing as "2 days ago", "1 day ago" and 1 minute ago its not give the data. When i pull the report we are not getting any output in the CSV.

Please find the Groovy script and the custom field value.

 

import com.atlassian.jira.component.ComponentAccessor
import java.sql.Timestamp
def customFieldManager = ComponentAccessor.getCustomFieldManager()
def dateCf = customFieldManager.getCustomFieldObject("customfield_10104") // Date time fields require a Timestamp
issue.setCustomFieldValue(dateCf, new Timestamp((new Date()).time))

 

CloseDateDate Time Picker

Please find the Screenshot for the same

TCD-1.pngCF.pngQuery.png

Can you please help me to solve this issue.

1 comment

John Funk Community Leader May 11, 2020

Hi Lokesh,

You can turn off relative dates by following this article:

https://confluence.atlassian.com/jirakb/display-standard-dates-in-jira-server-414187622.html?_ga=2.24967162.1132808388.1589116439-1313086432.1576012938

What does the value look like in the actual CSV?

Hi John,

In the CSV we are able to see the date and time, but in the JQL we are seeing only the # of days or mins

John Funk Community Leader May 11, 2020

So the CSV is good. Did you turn off the Relative dates based on the article above?

After doing these changes should I need to restart the JIRA servers? 

John Funk Community Leader May 11, 2020

Not sure - maybe just do a re-index?

Thank you very much, after setting jira.lf.date.relativize = false its showing the Date and time. 

John Funk Community Leader May 12, 2020

Great! Glad I could help a little. 

Comment

Log in or Sign up to comment
TAGS
Community showcase
Published in Jira Service Management

Known problems with customer accounts

The purpose of this post is to help people identify and resolve some of the most common problems that affect customer accounts in JSM projects.   1. Customers can't see their own requests in...

366 views 3 16
Read article

Community Events

Connect with like-minded Atlassian users at free events near you!

Find an event

Connect with like-minded Atlassian users at free events near you!

Unfortunately there are no Community Events near you at the moment.

Host an event

You're one step closer to meeting fellow Atlassian users at your local event. Learn more about Community Events

Events near you