Showing results for 
Search instead for 
Did you mean: 
Sign up Log in

Next challenges

Recent achievements

  • Global
  • Personal


  • Give kudos
  • Received
  • Given


  • Global

Trophy case

Kudos (beta program)

Kudos logo

You've been invited into the Kudos (beta program) private group. Chat with others in the program, or give feedback to Atlassian.

View group

It's not the same without you

Join the community to find out what other Atlassian users are discussing, debating and creating.

Atlassian Community Hero Image Collage

How to set due date via rest Edited

Hello everybody. I need to change due date field via REST API but there no any endpoints to set data and time, and I decided to write REST Endpoint via scriptrunner. Here is code 

@BaseScript CustomEndpointDelegate delegate

httpMethod: "POST", groups: ["jira-users"]
) { MultivaluedMap queryParams ->

def issue = ComponentAccessor.getIssueManager().getIssueByCurrentKey("TEST-767")
def dueDateField = issue.getDueDate()"Issue Key" + issue.key)"Old date: " + dueDateField.toString() + " Class: " + dueDateField.getClass().toString())
Timestamp date = new Timestamp(2020, 1, 15, 18, 30, 0, 0)"Date must be set : " + date)
def newDueDateField = issue.getDueDate()"New date: " + newDueDateField.toString() + " " + newDueDateField.getClass().toString())
return Response.ok(new JsonBuilder([abc: 42]).toString()).build()

When I look at logs everythin is fine and new date is seted

INFO [runner.ScriptRunnerImpl]: Old date: 2019-11-30 18:00:00.0 Class: class java.sql.Timestamp
INFO [runner.ScriptRunnerImpl]: Date must be set : 3920-02-15 18:30:00.0
INFO [runner.ScriptRunnerImpl]: New date: 3920-02-15 18:30:00.0    class java.sql.Timestamp

But when I look into issue the old date is seted there

I try in this script add a comment and it works, but date doesn't change :(

ComponentAccessor.getCommentManager().create(issue, issue.getReporterUser(), "bla bla", false)

Will be glad to any help.


1 answer

There already is a method of setting the due date of an issue, as 'duedate' is a valid field, as per this section of the Jira Server REST API documentation.

The field can be set when the issue is created, or updated afterwards.

Suggest an answer

Log in or Sign up to answer

Community Events

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

Find an event

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

Unfortunately there are no Community Events near you at the moment.

Host an event

You're one step closer to meeting fellow Atlassian users at your local event. Learn more about Community Events

Events near you