I am trying use script runner to clear the Due Date field when an issue is cloned so that the new issue does not have the old issue's Due Date.
I used a custom script post function to clear the field. The script runs fine but still would not clear the Due Date field.
Can someone suggest any alternatives or point what I'm doing wrong?
The code I'm using:
import com.atlassian.jira.component.ComponentAccessor
import com.atlassian.jira.issue.fields.IssueLinksSystemField
import webwork.action.ActionContext
import java.sql.Timestamp
def fieldManager = ComponentAccessor.getFieldManager()
def linksSystemField = fieldManager.getField("issuelinks") as IssueLinksSystemField
def request = ActionContext.getRequest()
if (request) {
def params = request.getParameterMap()
def issueLinkingValue = linksSystemField.getRelevantParams(params) as IssueLinksSystemField.IssueLinkingValue
if ( (issueLinkingValue.linkDescription == "is cloned by" )) {
issue.setDueDate(null)
}
}
Thanks
Hello @Sid
It is very strange code, but lets try to store changes with issueManager.update issue
import com.atlassian.jira.component.ComponentAccessor
import com.atlassian.jira.event.type.EventDispatchOption
import com.atlassian.jira.issue.fields.IssueLinksSystemField
import webwork.action.ActionContext
import java.sql.Timestamp
def fieldManager = ComponentAccessor.getFieldManager()
def linksSystemField = fieldManager.getField("issuelinks") as IssueLinksSystemField
def request = ActionContext.getRequest()
if (request) {
def params = request.getParameterMap()
def issueLinkingValue = linksSystemField.getRelevantParams(params) as IssueLinksSystemField.IssueLinkingValue
if ( (issueLinkingValue.linkDescription == "is cloned by" )) {
issue.setDueDate(null)
ComponentAccessor.getIssueManager().updateIssue(issue.getAssignee(), issue, EventDispatchOption.ISSUE_UPDATED, false)
}
}
And see what happens :)
Online forums and learning are now in one easy-to-use experience.
By continuing, you accept the updated Community Terms of Use and acknowledge the Privacy Policy. Your public name, photo, and achievements may be publicly visible and available in search engines.
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.