Come for the products,
stay for the community

The Atlassian Community can help you and your team get more value out of Atlassian products and practices.

Atlassian Community about banner
Community Members
Community Events
Community Groups

How to automatically set the date in calendar ?

how to automatically set the date (deadline) in cf "deadline" = (creation date +14 days)
my code in post-function.. no work

import com.atlassian.jira.component.ComponentAccessor

import java.sql.Timestamp

def versionManager = ComponentAccessor.getVersionManager()

def projectComponentManager = ComponentAccessor.getProjectComponentManager()

def customFieldManager = ComponentAccessor.getCustomFieldManager()

def userUtil = ComponentAccessor.getUserUtil()

// a date time field - add 14 days to current datetime

def dateCf = customFieldManager.getCustomFieldObjectByName("my_deadline") // Date time fields require a Timestamp


2 answers

1 accepted

3 votes
Answer accepted

Hi @Oliver Smith

I have provided a solution for this in this link

I hope this helps to solve your question. :)

Thank you and Kind regards,


Thank you!!! It’s working 

0 votes

Hi @Oliver Smith 

The following smart value should be used within Automation. Do you have it?


If yes, please go to project -> project settings -> automation and add new rule. Then, choose the trigger (ex; issue created) and edit your custom field with it.

Check this answer also.

Hi! @Tansu Akdeniz  

hmm, I don't have automation, I'm writing a script from scratch..

Tansu Akdeniz Community Leader Aug 18, 2022

Got it. Please check this page also.


issue.setCustomFieldValue(dateCf, new Timestamp((new Date() + 14).time))

Suggest an answer

Log in or Sign up to answer

Atlassian Community Events