Hi ,
I would like to get the Release date from the Fix version and Clear the due date if the Fix version is setup to Empty. I'm not good in scripting, can someone help on this?
import com.atlassian.jira.component.ComponentAccessor
import com.atlassian.jira.issue.CustomFieldManager
import com.atlassian.jira.issue.Issue;
import com.atlassian.jira.project.version.Version
import com.atlassian.jira.issue.MutableIssue
import com.atlassian.jira.event.type.EventDispatchOption
import com.atlassian.jira.issue.IssueManager
import java.util.ArrayList;
import java.util.Collection;
Collection<Version> fixVersions = new ArrayList<Version>();
IssueManager issueManager = ComponentAccessor.getComponent(IssueManager.class)
def customFieldManager = ComponentAccessor.getCustomFieldManager()
//Custom field for Due date
def cDuedate = ComponentAccessor.getCustomFieldManager().getCustomFieldObject("customfield_12111")
def cDuedateValue = event.issue.getCustomFieldValue(cDuedate)
def issue = (MutableIssue)event.issue
def version = (Version)issue.getFixVersions().first()
def setDate = version.getReleaseDate() as Date
def issueVersions = event.issue.getFixVersions()
def fixVersion= issue.getFixVersions()
log.warn "Release Date = ${setDate}"
//if (fixVersion.empty) {
if (issue.fixVersions*.name.contains("None")){
issue.setCustomFieldValue (cDuedate,null)
issueManager.updateIssue(event.getUser(), issue , EventDispatchOption.ISSUE_UPDATED, false)
} else {
issue.setCustomFieldValue (cDuedate,setDate)
issueManager.updateIssue(event.getUser(), issue , EventDispatchOption.ISSUE_UPDATED, false)
}
Hi @Rodolfo So
Did you see this similar community posting and answer on this topic:
How to use ScriptRunner to update Issue Due Date based on fixVersion release Date
Best regards,
Bill
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.