Forums

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

Scriptrunner post func to clear a value if the issue is cloned

Emily C. October 14, 2020

Racking my brain on this one, hope you guys can help.

I'm trying to create a groovy script that will clear out the value of a custom field upon issue creation, but only if it's a clone of another ticket. This is our workaround for avoiding the propagation of custom field data when creating a clone.

 

Here's my code thus far; no failures, but no results:

 

import com.atlassian.jira.component.ComponentAccessor

def customFieldManager = ComponentAccessor.getCustomFieldManager()


def clonedIssues = ComponentAccessor.getIssueLinkManager().getOutwardLinks(issue.getId())?.findAll {it.issueLinkType.outward == "Clones"};

if (clonedIssues) {
def cfpival = customFieldManager.getCustomFieldObjectByName("PI/Sprint Value") //Set custom text field with current date & time if blank
issue.setCustomFieldValue(cfpival, null)

}

 

 

I should note that the post func is at the very top of the list of functions to be executed, even above 'Create the issue originally'.

 

Any ideas?

0 answers

Suggest an answer

Log in or Sign up to answer
TAGS
AUG Leaders

Atlassian Community Events