Post function to set date field to X days from transition date?

I'm trying to create post function that will set a date field (date only, not date and time) to X amount of days from the transition date.

While configuring, there's an info message that states: "You may use macro '%%CURRENT_DATETIME%%' to insert the current date and time." But my field is a date only and I'm interested in setting a date that is X days from the transition date/current date.

Any tips on what to enter in "Custom Field Value"? Thank you!

1 answer

Hey @Ronny,

If you're open to trying add-ons, I'd recommend using something like Power Scripts.

Here's an example video guide and script of a similar kind of setup for automatically calculating the due date based on a custom field value.

If you're familiar with coding, it should be pretty straightforward to modify this to your needs:

/*Call this script from a workflow transition post-function.It will set the due date based on the value of customfield 10703.*/ if(isNotNull(customfield_10703)) {    interval i = (string)customfield_10703 + "d";    dueDate = currentDate() + i;};

Hope this helps!


Suggest an answer

Log in or Join to answer
Community showcase
Sarah Schuster
Posted Jan 29, 2018 in Jira

What are common themes you've seen across successful & failed Jira Software implementations?

Hey everyone! My name is Sarah Schuster, and I'm a Customer Success Manager in Atlassian specializing in Jira Software Cloud. Over the next few weeks I will be posting discussion topics (8 total) to ...

2,816 views 11 18
Join discussion

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
Atlassian Team Tour

Join us on the Team Tour

We're bringing product updates and pro tips on teamwork to ten cities around the world.

Save your spot