Hi Team,
I am trying to populate a Date field by Adding days to another date field value.
Consider, there are two date fields "Start Date" & "End Date" and a numeric field "Number Field" for days.
Required Output : End Date = Start Date+NumberField
How can I achieve this with the groovy script?
I used the below code but getting below error, Please help me on this.
Issue issue = issue
def customFieldManager = ComponentAccessor.getCustomFieldManager()
def daysToAddCF = customFieldManager.getCustomFieldObjectByName("Duration")
def dateACF = customFieldManager.getCustomFieldObjectByName("StartDate")
def dateAValue = issue.getCustomFieldValue(dateACF) as Date
def daysToAdd = issue.getCustomFieldValue(daysToAddCF) as int
def EndDate = Calendar.getInstance()
EndDate.setTime(dateAValue)
EndDate.add(Calendar.DATE, daysToAdd)
return EndDate.getTime()
Hi Musku,
I am not familiar with Groovy, but it can easily be done with an Automation For Jira rule.
Hi John,
Thanks for you quick respond, yes, but I am looking to get this fields should be populate automatically in create screen like End Date = Startdate=Duration .
With help of automation we can get that field create automatically once issue has been created.
Thanks
Nagaraju
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.