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

Set the field value based on custom date value

Hi Team,

I am on jira server (8.7.1), and available addons are JMWE, scriptrunner, JSU, etc. I am trying to achieving through JMWE (Set Field Value function), but i did not find any date function on within 24 hours of creation date.

The requirement is,

If Need By Date is within 24 hours of Creation date, then Escalation? field must equal 'Yes'.

I am trying with issue.get("Need By Date") == (new Date().clearTime() >= -24h

Could anyone please help on this correct function ?

Thanks!

 

2 answers

1 accepted

0 votes
Answer accepted

Hi @Lakshmi S ,

you can use this code as the conditional execution script of the Set Field Value post-function:

issue.get("Need By Date").time < (new Date()).time + 24*60*60*1000

  The value of the post-function is Yes, and of course the field is Escalation

@David Fischer _Innovalog_, Thank you soooooooooo much. Its working as expected.

If you output those two values to the log file what do they say? 

You may be comparing a string object with a date object which will never be equivalent

This would only work if the date was exactly 24h ago.... you probably want two date objects and want to check if the date set is equal to or less than to +24 hours.

Hi @Aiden Marriott ,

 No, we are not comparing string object with date. The date custom field (Need By date) is within 24 of ticket creation date, then change the "Escalation" field value to YES in the ticket.

If Need By Date is within 24 hours of Creation date, then Escalation? field must equal 'Yes'.

 

Thanks!

Suggest an answer

Log in or Sign up to answer
TAGS
Community showcase
Posted in Jira Software

Presenting the "Best of 2020" Jira Software roundup!

Catch up with Atlassian Product Managers in our 2020 Demo Den round-up! From Advanced Roadmaps to Code in Jira to Next-Gen Workflows, check out the videos below to help up-level your work in the new ...

7,184 views 8 28
Join discussion

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