The Atlassian Community Forums are currently in read-only mode. We will be relaunching on a new platform on September 22 (read more here). We apologize for the extended downtime. For concerns or questions, please email communitymanagers@atlassian.com. See you on the other side, on the new Atlassian Community Forums! :)

×

Forums

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

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

Comments for this post are closed

Community moderators have prevented the ability to post new answers.

Post a new question

DEPLOYMENT TYPE
CLOUD
PRODUCT PLAN
STANDARD
PERMISSIONS LEVEL
Product Admin
TAGS
AUG Leaders

Atlassian Community Events