Forums

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

automatically set the Due Date

Viktor Shkvarskyi June 20, 2023

I need to automatically set the Due Date to the current date plus 48 hours from the moment of issue creation for tasks created in Jira (only for projects with key 'N') and with the Issue Type 'Ticket'. For example, if a ticket is created on June 13th at 12:00, the Due Date should be set to June 15th at 12:00, excluding weekends.

If I use the expression {{#issue.dueDate}}func=now.plusBusinessDays(2){{/}}, the Due Date field is only updated if it already has a value.

Could someone help me with this?

when i use {{#issue.created}}{{.format("yyyy/MM/dd")}}{{/}}
Error rendering smart-values when executing this rule: The datetime zone id 'GMT+02:00' is not recognised: {{#issue.created}}{{.format("yyyy/MM/dd")}}{{/}}

Jira v8.12.2

4 answers

0 votes
Viktor Shkvarskyi June 20, 2023

Does Jira Software 8.12.2 have the function .format("yyyy-MM-dd") at all?

0 votes
Dan.Tombs
Contributor
June 20, 2023

Depending on rule structure, could we switch the smart value out to {{now.plusBusinessDays(2)}}? It would achieve the same thing as running off of creation

Viktor Shkvarskyi June 20, 2023

Hello, no, its doesnt works too

0 votes
Florian Bonniec
Community Champion
June 20, 2023

Hi @Viktor Shkvarskyi 

 

This smart value should works.

{{issue.created.plusDays(2)}}

Regards

Viktor Shkvarskyi June 20, 2023

Hi, its doesnt works 2 

Edit issue

Error rendering smart-values when executing this rule:
Failed to get value for issue.created.plusDays(2): {{issue.created.plusDays(2)}}
Florian Bonniec
Community Champion
June 20, 2023

Just to make sure, is there any customfield with the name created ?

Have you try to replace issue.created by now ?

0 votes
John Funk
Community Champion
June 20, 2023

Hi Viktor - Welcome to the Atlassian Community!

What if you just changed out dueDate in your first example with created? 

 {{#issue.created}}func=now.plusBusinessDays(2){{/}}

Viktor Shkvarskyi June 20, 2023

Hi, thx 4 answer, but error )
Error rendering smart-values when executing this rule:

The datetime zone id 'GMT+02:00' is not recognised: {{#issue.created}}func=now.plusBusinessDays(2){{/}}
John Funk
Community Champion
June 20, 2023

Can you include a screenshot of exactly where you are using this?

Viktor Shkvarskyi June 20, 2023

yep =)

Viktor Shkvarskyi June 20, 2023

image.png

Viktor Shkvarskyi June 20, 2023

image.png

John Funk
Community Champion
June 20, 2023

Okay, try this in the Due Date field:

{{issue.created.plusDays(2)}}

John Funk
Community Champion
June 20, 2023

And are you using any add-ons related to this?

Viktor Shkvarskyi June 21, 2023

Hello, 

To test the format requirements of the Due Date field, I tried setting issue.createDate.toInstant().atOffset(ZoneOffset.UTC) manually to the Due Date field

Now I don't get any errors in the logs, but the date is still not set in the Due Date field

That is, I first try to set today's date, and then add 2 business days to it.

The problem is more that I cannot determine today's date for DueDate field

John Funk
Community Champion
June 21, 2023

See if you can set it to {{now}} when it is created. 

And if that works, then add an Edit Issue after that first update to use:

{{issue.duedate.plusDays(2)}}

Viktor Shkvarskyi June 21, 2023

{{now}} doesnt works on Jira Software 8.12.2image.png


John Funk
Community Champion
June 21, 2023

I really think something is jacked up with your instance. {{now}} should work. 

https://confluence.atlassian.com/automation/jira-smart-values-date-and-time-993924864.html

I would go ahead and submit a support ticket with Atlassian. 

https://support.atlassian.com/contact/#/

Suggest an answer

Log in or Sign up to answer