Forums

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

Copy fixversion release date to custom date field

Hemant Sirdeshpande
I'm New Here
I'm New Here
Those new to the Atlassian Community have posted less than three times. Give them a warm welcome!
June 13, 2018

Hi there,

I am trying to copy fixVersion release date to a custom date filed. I am not quite clear on how to update the custom filed. Can someone help?

 

import com.atlassian.jira.component.ComponentAccessor 
import com.atlassian.jira.issue.Issue
import com.atlassian.jira.ComponentManager

def customFieldManager = ComponentAccessor.getCustomFieldManager()
def cDuedate = customFieldManager.getCustomFieldObjectByName("Customer Due Date")
def cDuedateValue = issue.getCustomFieldValue(cDuedate)

def version = issue.getFixVersions()
def setDate = version

log.warn "Release Date = ${setDate}"

issue.setCustomFieldValue (cDuedate,setDate)




 

1 answer

0 votes
Prakhar Srivastav {Appfire}
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.
June 14, 2018

@Hemant Sirdeshpande

version will be a collection of version so ,first you need to get the  Version Obj by iterating the collection and then use getReleaseDate on it . Assuming you want the first fix version :

import com.atlassian.jira.component.ComponentAccessor 
import com.atlassian.jira.issue.Issue
import com.atlassian.jira.ComponentManager

def customFieldManager = ComponentAccessor.getCustomFieldManager()
def cDuedate = customFieldManager.getCustomFieldObjectByName("Customer Due Date")
def cDuedateValue = issue.getCustomFieldValue(cDuedate)

def version = issue.getFixVersions()
def setDate = version.iterator().next().getReleaseDate() as Date

log.warn "Release Date = ${setDate}"

issue.setCustomFieldValue (cDuedate,setDate)

Suggest an answer

Log in or Sign up to answer