How do I automatically set the Due Date of an issue via a workflow post funtion

I would like the due date of an issue to be automatically set to now() via a post function - ie, any issue created today are due today.

I believe that the way to do this is via the script runner Plugin and to run a Custom Script Post Function from the Create state but the scripts that I have found online do not work.

Can anyone help me with what script I would use to achieve this.

 

1 answer

1 accepted

2 votes
Sam Hall Community Champion Jan 17, 2017

Hi Frank,

There are some alternatives:  

If you are sticking with ScriptRunner for JIRA, did you try the following?:

issue.setDueDate(new Timestamp((new Date()).time))

Adapted from: https://scriptrunner.adaptavist.com/latest/jira/recipes/workflow/postfunctions/set-issue-attributes.html and also: https://answers.atlassian.com/questions/32996494

Hope this helps.

Sam

Awesome - thanks Sam!

I used the first option, tested and works perfectly,

thank you

Is there really no native way to do this? That's mental.

We have a cloud install, so most options here are not available, or require an add-on purchase which just feels a bit like taking a nuclear bomb to kill a mole in your back yard.

Suggest an answer

Log in or Sign up to answer
How to earn badges on the Atlassian Community

How to earn badges on the Atlassian Community

Badges are a great way to show off community activity, whether you’re a newbie or a Champion.

Learn more
Community showcase
Published Thursday in Confluence

Color tables for a shiny Confluence page

...; ## Developed by: Alana Fernando ## Shared with love ## @param style:title=style type|type=enum|required=true|desc=Choose a style.|enumValues=Style1,Style2,Style3,Style4,Style5 ## @param alignment:title...

143 views 8 11
Read article

Atlassian User Groups

Connect with like-minded Atlassian users at free events near you!

Find a group

Connect with like-minded Atlassian users at free events near you!

Find my local user group

Unfortunately there are no AUG chapters near you at the moment.

Start an AUG

You're one step closer to meeting fellow Atlassian users at your local meet up. Learn more about AUGs

Groups near you