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.ComponentAccessorimport java.sql.Timestampdef versionManager = ComponentAccessor.getVersionManager()def projectComponentManager = ComponentAccessor.getProjectComponentManager()def customFieldManager = ComponentAccessor.getCustomFieldManager()def userUtil = ComponentAccessor.getUserUtil()// a date time field - add 14 days to current datetimedef dateCf = customFieldManager.getCustomFieldObjectByName("my_deadline") // Date time fields require a Timestampissue.setCustomFieldValue(dateCf,{{now.plusBusinessDays(14)}})
Hi @Alex
I have provided a solution for this in this link https://community.atlassian.com/t5/Jira-Service-Management/how-Add-to-my-cf-calendar-14-days/qaq-p/2111753#M112706
I hope this helps to solve your question.
Thank you and Kind regards,
Ram
The following smart value should be used within Automation. Do you have it?
{{now.plusBusinessDays(14)}}
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..
Got it. Please check this page also.
Sample;
issue.setCustomFieldValue(dateCf, new Timestamp((new Date() + 14).time))
Thank you!!! It’s working
It looks like you're new here. Sign in or register to get started.