Show custom date fields under tab instead of dates area

Christian Czaia _Decadis AG_
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.
July 12, 2012

Hi,
date fields in JIRA, no matter if custom or system fields, are bein displayed in the "Dates" area. Until now I could live with that.
Now I had to create a generic workflow with x milestones. My customer wants the name of the milestone and the corresponding due date (as configured in my tab "milestones") displayed together. Has anyone an idea how I could accomplish that?

Thinking of workarounds I've been contemplating copying the date value into another custom field where the date is being represented as a string (seeting the string field to invisible via a behaviour).
Another idea might be (if thats possible) concatinating the milestone description field and the corresponding date field...

As you can see I'm pretty lost here.

Thanks for any help

Christian

5 answers

1 accepted

0 votes
Answer accepted
Jobin Kuruvilla [Adaptavist]
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.
July 12, 2012

The field appears there because the standard date field implements DateField interface. If you create a date custom field that doesn't implement the interface, it will appear as normal fields.

You can then put it under any tabs you want.

Another option is to tweak the bundled view issue plugin!

Christian Czaia _Decadis AG_
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.
July 15, 2012

Hey Jobin,

this can't be done through the normal UI I guess... How can I modifiy the custom field in order to prevent implementing the DateField interface?

Nic Brough -Adaptavist-
Community Leader
Community Leader
Community Leaders are connectors, ambassadors, and mentors. On the online community, they serve as thought leaders, product experts, and moderators.
July 15, 2012

I think that Jobin is suggesting that you create a new custom field type - it can be the same as the standard off-the-shelf Date custom field (if you have a license for Jira, you could download the source and see how that one works), but you tweak it slightly so that Jira thinks it's plain text (even though you could retain the date/time output, field handling and so-on)

Jobin Kuruvilla [Adaptavist]
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.
July 15, 2012

Meant exactly what Nic said.

Jigar D Patel June 1, 2017

I am trying to achieve same as Christina Czaia. I created custom date-field from custom field but it still shows under the date section. How can I tweak slightly?

Nic Brough -Adaptavist-
Community Leader
Community Leader
Community Leaders are connectors, ambassadors, and mentors. On the online community, they serve as thought leaders, product experts, and moderators.
June 1, 2017

You don't.  If it's a date field, it's going to be moved.

If you want a date that doesn't move to the date panel, you will need to create a new field type that JIRA does not recognise as a date.  That needs an add-on.

1 vote
DOT-COMmunications July 12, 2012

Im interested in this too so hope someone can help

1 vote
DOT-COMmunications July 12, 2012

Im interested in this too so hope someone can help

0 votes
Witold Dziel March 22, 2020

You can always create new text field and during on of the transitions, copy the value of a date field and paste in to a text field. With this, you will be able to show it on any tab you want. It's kind of a workaround, but it did the job for me.

siva November 10, 2020

@Witold Dziel 

I have tried the same 

my scripted field ends with

"def total = rt.sum() as Long
return (total / 1000) as long ?: 0L"

image.png

But when i copy the time to resolve scripted filed the output in text field is 

image.png

the above field is text filed , 

it copies nos, rather than 14 hous,12 minutes.

any suggestion on that

Nic Brough -Adaptavist-
Community Leader
Community Leader
Community Leaders are connectors, ambassadors, and mentors. On the online community, they serve as thought leaders, product experts, and moderators.
November 11, 2020

Your script is returning a number into a string field, so the field doesn't really know what you're trying to tell it. 

My best guess is that your script should to changing the number returned explicitly to the string you want to see, but it is an odd conversion there, not what I would expect. 

We don't know what tool you are using for the scripting, and I suspect there are other parts of the script we'd need to see before we can tell you what it is doing (against what it should)

siva November 11, 2020

time to resolution field is created from ===> Time in status ++ (plut in)

I am using script runner in the system

Nic Brough -Adaptavist-
Community Leader
Community Leader
Community Leaders are connectors, ambassadors, and mentors. On the online community, they serve as thought leaders, product experts, and moderators.
November 11, 2020

Ok, well, this does not look like what scriptrunner would do given just the lines of code you've given, so I'm a bit stuck.  Could you give us the rest of the script?

siva November 11, 2020

@Nic Brough -Adaptavist- 

import com.atlassian.jira.component.ComponentAccessor
import com.atlassian.jira.issue.history.ChangeItemBean
import com.atlassian.jira.issue.Issue;
import com.atlassian.core.util.DateUtils

def changeHistoryManager = ComponentAccessor.getChangeHistoryManager()

def inProgressName = "In Progress"

List<Long> rt = [0L]

def changeItems = changeHistoryManager.getChangeItemsForField(issue, "status")
changeItems.reverse().each { ChangeItemBean item ->

def timeDiff = System.currentTimeMillis() - issue.getCreated().getTime()

if (item.fromString == inProgressName) {
rt << -timeDiff
}

if (item.toString == inProgressName) {
rt << timeDiff
}


def total = rt.sum() as Long
return (total / 1000) as long ?: 0L

//////////////////////////////////////////////////

 

How do i copy the output to a text field.

When i try to copy it gives me , the output in seconds.

Nic Brough -Adaptavist-
Community Leader
Community Leader
Community Leaders are connectors, ambassadors, and mentors. On the online community, they serve as thought leaders, product experts, and moderators.
November 11, 2020

So, it's not giving you what you have in your screenshot ?  It's giving you a properly formatted number?

siva November 11, 2020

image.png

the scripted field value shows 31 minues.

 

 

when the value is copied to the text field "Time-to-resolve()" has the below value.

image.png

Nic Brough -Adaptavist-
Community Leader
Community Leader
Community Leaders are connectors, ambassadors, and mentors. On the online community, they serve as thought leaders, product experts, and moderators.
November 11, 2020

No, the "scripted field" is showing 1897 (seconds).  The source field (which is not the scripted field) is showing 31 minutes  (or 1897/60 rounded down)

That's not what you showed us before.

However, it is now showing correctly.  Your script is returning a simple number which can be cast to a string automatically.  The script says 1897, so that's what goes into the string.

If you want it to come out in a different format, your code will need to do some work to convert it.

siva November 12, 2020

@Nic Brough -Adaptavist-  

my bad.

Let me rephrase my question, 

  • the script above is for a scripted field "time to resolve" which gives ( 31 minutes ) as output.
  • And  the field is shows under Date tab, on the right side of the ticket.

Now i am trying to show the "Scripted field under the regular tabs of the tickets"
image.png

Any options to COPY or MOVE the scripted date field under the tab.

Nic Brough -Adaptavist-
Community Leader
Community Leader
Community Leaders are connectors, ambassadors, and mentors. On the online community, they serve as thought leaders, product experts, and moderators.
November 26, 2020

Sorry for the delay.

I don't recognise that behaviour, the field should be in the custom field section, unless the output was defined as a date/time field, which wouldn't come out with "31" or "31 minutes" in it.

0 votes
Radu Dumitriu
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.
July 12, 2012

Can this be of any help ?

http://confluence.kepler-rominfo.com/display/KCF/SIL+Script+Custom+Field

Its configuration would be something like:

return "Milestone: " + customfield_10011 + " Due: " + dueDate;

siva November 18, 2020

the link doesnt work, could you  give the script

Nic Brough -Adaptavist-
Community Leader
Community Leader
Community Leaders are connectors, ambassadors, and mentors. On the online community, they serve as thought leaders, product experts, and moderators.
November 26, 2020

It is an 8 year old link.  Things have changed.

Suggest an answer

Log in or Sign up to answer