Forums

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

Automation to set due date automatically not working, could use help

Mike Prill October 4, 2023

I'm trying to automatically set an issue's due date based on the following:

1. If the value of custom field "Departure Date" is more than 3 days away, then set the due date to now.plusDays(3) - since it can wait a little.

2. If the Departure Date is within 3 days from now, make the due date right now (because we gotta do stuff immediately).

I have scriptrunner but I'm new with it, so I'm trying to use Automation. I have an If statement checking JQL and that part seems to work, but its erroring out saying the Due date field may be unavailable for the project/type. I've checked in screens and in my field configuration and Due date is definitely in both, so not sure what to try now.

jiraAutomationNotSettingDueDate.png

I've tried setting Due date as {{now}}, {{now.plusDays(3).abs}}, {{now.plusDays(3).format("MM/dd/yyyy")}} etc with no luck. 

2 answers

1 accepted

0 votes
Answer accepted
Mike Prill October 5, 2023

Figured out I had shot myself in the foot and accidentally blocked Automation for Jira's edit rights, so it just couldn't write the field. Once I re-added permissions for Automation for Jira then everything worked. Whoopsies.

0 votes
Valerie Knapp
Community Champion
October 4, 2023

Hi @Mike Prill , thanks for your question.

First, I always recommend that people take a look at the Automation library provided by Atlassian here -Jira automation template library | Atlassian. This is a great place to see some worked examples of what is possible.

If you search the word 'date'. you can see there are some rules here which might give you some ideas -

image.png

I have some questions for you now. This issue, FLRT-24, for which criteria should it be triggering the automation? The feedback that the automation has given is that the issue doesn't match the JQL. Have you tried just pasting the query into the filter results to see how many issues meet the criteria?

image.png

Next, I would advise to break that JQL query down and run more tests to see up until what point the rule still runs without an error. You can also try putting a log action into the rule to return the results, for example, of the 'Departure Date' so you can see against which criteria the action should be called.

I hope this gives you some ideas of what to try next. If you need more help, please write us here.

Cheers

Mike Prill October 5, 2023

Hi @Valerie Knapp 

The jql does show me the correct items when I use it as a filter. I've tried simple and complex jql but the error still surrounds the due date field. 

Here's an example of much easier jql but the same due date field issue:

simple Due date error.pngsimple Due date error 2.png

I'm just using " {{now.plusDays(4)}} " as the action, which I see in several examples.

Suggest an answer

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

Atlassian Community Events