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

Next challenges

Recent achievements

  • Global
  • Personal

Recognition

  • Give kudos
  • Received
  • Given

Leaderboard

  • Global

Trophy case

Kudos (beta program)

Kudos logo

You've been invited into the Kudos (beta program) private group. Chat with others in the program, or give feedback to Atlassian.

View group

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

Show custom date fields under tab instead of dates area

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

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!

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?

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)

Meant exactly what Nic said.

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?

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.

Im interested in this too so hope someone can help

Im interested in this too so hope someone can help

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;

the link doesnt work, could you  give the script

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

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.

@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

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)

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

I am using script runner in the system

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?

@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.

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

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

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.

@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.

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.

Suggest an answer

Log in or Sign up to answer
TAGS

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