How can we write groovy script for date field.

Salwadi Edukondal March 30, 2020

I have writen code like below.

// Specify the issue key to update
def issueKey = 'VD-13'

// Get today's date to set as the due date
def today = new Date()

// Update the issue
def result = put("/rest/api/2/issue/${issueKey}")
.header('Content-Type', 'application/json')
.body([
fields:[
// Set the due date to today's date
customfield_10655: today.format('yyyy-MM-dd') as String
]
])
.asString()

// Validate the issue updated correctly
if (result.status == 204) {
return "Success - The issue with the key of ${issueKey} has been updated with a new due date"
} else {
return "${result.status}: ${result.body}"
}

My requirement is +5 days needs to be add to current date.

For example today date is 6 and system needs print (6+5) 11.How could i write code for that.

Thanks in advance.

0 answers

Suggest an answer

Log in or Sign up to answer
DEPLOYMENT TYPE
CLOUD
PRODUCT PLAN
STANDARD
PERMISSIONS LEVEL
Site Admin
TAGS
AUG Leaders

Atlassian Community Events