Create
cancel
Showing results for 
Search instead for 
Did you mean: 
Sign up Log in
Deleted user
0 / 0 points
Next:
badges earned

Your Points Tracker
Challenges
Leaderboard
  • Global
  • Feed

Badge for your thoughts?

You're enrolled in our new beta rewards program. Join our group to get the inside scoop and share your feedback.

Join group
Recognition
Give the gift of kudos
You have 0 kudos available to give
Who do you want to recognize?
Why do you want to recognize them?
Kudos
Great job appreciating your peers!
Check back soon to give more kudos.

Past Kudos Given
No kudos given
You haven't given any kudos yet. Share the love above and you'll see it here.

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

How to add a CF that always has todays date?

Hi,

I am looking for the script to make sure that a custom field e.g. "Today" displays always todays date e.g. May 07, 2021 without making any update on the issue itself.

Can anyone help and explain what to do exactly? Not sure if I have to use a scripted field, behavior or anything else. 

I need to use this field to make a comparison later on between two date fields e.g. "Today" and "Due Date". 

Thanks,

Michael

2 answers

1 accepted

1 vote
Answer accepted

You can do this with Scriptrunner (I'm taking a guess that you're looking at that because you mention Behaviours), but it's not going to do what you want very well.

This is because of what a field is - the content is something that is part of an issue.  It does not change unless something changes it whether that's code or a human.

If you were to do this with a standard date field, then a script to populate it would be very simple, as all it would need to do is "put now() in custom field".

But, it will set the date to now when it is run.  At midnight tonight, it then becomes wrong, because it's still going to hold today's date.  So you would need to run a second script at midnight to find every issue it is populated on and update the issue, setting the field to the new date.

On server, you have the option of a scripted field, with a script behind it that's not a lot more complex than "return now()"

But again, that is fixed data and you'll need to update it at midnight every night.  With a scripted field, you can have less impact - they don't store their data in the database and you can trigger and update with some code that just triggers a re-index on the issue without changing it.

Either way though, you're having to perform potentially large updates every night.

I would forget it and look at the comparison you are doing instead.   Usually, people are doing comparisons in JQL, and that doesn't need a field to do what I think you are looking for.  For example 

duedate > now()

will list all issues with a due date after today.

Many thanks for your response, Nic. Have a nice weekend

0 votes
Jack Community Leader May 07, 2021

I am wondering if you could use automation to achieve your goal. Are use automation in some rules to compare a date to today’s date without having to have a custom field displays today’s date. You might check the Automation documentation for this. 

Hi Jack, many thanks.

We have JIRA server and according to Atlassian, automation is not actively available for Server customers....

Alternatively, I am also fine if another CF "Delayed?" displays "Yes" or "No".

Can you help?

Michael

Jack Community Leader May 07, 2021

Sorry I missed that you were on server. You’re gonna need some sort of ad on the manage these dates and custom fields. Not a ure I can really help you beyond that. 

Suggest an answer

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

JSM June ask me anything (AMA)

Hello Community members! We’re wrapping up the end of JSM June with an Ask Me Anything (AMA) with the Jira Service Management product team. This is your chance to ask all your ITSM questions to o...

78 views 3 8
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