Forums

Articles
Create
cancel
Showing results for 
Search instead for 
Did you mean: 

How do I set due date to be the minimum between two dates?

Laetitia Gascon December 16, 2022

Hi, 

 

I'd like to set the due date to be the minimum between {{now.plusBusinessDays(1)}} and a custom date field.

My synthax seems to be wrong : 

min({{now.plusBusinessDays(1)}},{{"Customfield[Date]"}} <= endOfDay("+15d"))

 

Thanks !

Laetitia

1 answer

0 votes
Marta Woźniak-Semeniuk
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.
December 16, 2022

Hey @Laetitia Gascon 

So you want to set Due Date to be be set on the closest possible date between tomorrow and the custom date field? 

That would mean you can just set it to the custom date? 

Please elaborate cause I think I am missing something here :) 

Laetitia Gascon December 16, 2022

Sorry I meant : {{now.plusBusinessDays(10)}

Laetitia Gascon December 16, 2022

+tomorrow is not a business day :) 

Marta Woźniak-Semeniuk
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.
December 16, 2022

Are you doing this with automation or with ScriptRunner?

Laetitia Gascon December 16, 2022

Thanks for your quick reply.

Automation

Marta Woźniak-Semeniuk
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.
December 16, 2022

Okay so we want JIRA to choose between CustomFieldDate and {{now.plusBusinessDays(10)} - whichever will come first?

Laetitia Gascon December 16, 2022

exactly

Marta Woźniak-Semeniuk
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.
December 16, 2022

Okay, so what I came up with is below.

  1. I don't know what your trigger is so for my POC I made a transition a trigger just to check
  2. Then I used IF-ELSE
  3. in IF I check if my CustomDateField that I called"SLA date" comes before  10 days from now
  4. =true - edit due date field to match my "SLA date" CustomDateField [I used smart value that gets the field input by CustomFieldId - I know the CustomFieldId from here "by url" https://confluence.atlassian.com/jirakb/how-to-find-id-for-custom-field-s-744522503.html"
  5. if = false - edit date to match 10 days from now {{now.plusBusinessDays(10)}}

It works for me.

auto1.pngauto2.pngauto3.png

Suggest an answer

Log in or Sign up to answer
DEPLOYMENT TYPE
CLOUD
PRODUCT PLAN
STANDARD
PERMISSIONS LEVEL
Product Admin
TAGS
AUG Leaders

Atlassian Community Events