Forums

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

How to set current date to the Due Date field in Jira issue using groovy?

Peddinti Hemanth Satyakumar January 20, 2019

Hi Team, I'm trying to set the due date field to be set to today's date by select another field I tried few suggestions but I cannot make it, could anyone can help here? thanks in advance.

1 answer

0 votes
Ivan Tovbin
Rising Star
Rising Star
Rising Stars are recognized for providing high-quality answers to other users. Rising Stars receive a certificate of achievement and are on the path to becoming Community Leaders.
January 21, 2019

Hi,

You do it like so:

import com.atlassian.jira.component.ComponentAccessor
import com.atlassian.jira.event.type.EventDispatchOption
import com.atlassian.jira.user.ApplicationUser
import java.sql.Timestamp

ApplicationUser currentUser = ComponentAccessor.getJiraAuthenticationContext().getLoggedInUser()
Timestamp currentDate = new Timestamp(System.currentTimeMillis())
issue.setDueDate(currentDate)
ComponentAccessor.getIssueManager().updateIssue(currentUser, issue, EventDispatchOption.ISSUE_UPDATED, false)
Peddinti Hemanth Satyakumar January 21, 2019

Hi Ivan, 

Thanks for the reply, what I'm trying is when I create an issue I have the two fields due date(system field) and priority(select list drop-down), I need to auto-populate the due date field to today's date when I select any of the select list in the priority field.

 

Thanks,

Hemanth.

Suggest an answer

Log in or Sign up to answer