-* This example script listner script must bve configured to fire on the 'Issue Link Created' Event and shows how when an issue is cloned that you can clear the value of the description field and a single line text field on the cloned issue.
+* This example script listner script must be configured to fire on the 'Issue Link Created' Event and shows how when an issue is cloned that you can clear the value of the description field and some custom fields on the cloned issue.
* "All right, title and interest in this code snippet shall remain the exclusive intellectual property of Adaptavist Group Ltd and its affiliates. Customers with a valid ScriptRunner
* license shall be granted a non-exclusive, non-transferable, freely revocable right to use this code snippet only within their own instance of Atlassian products. This licensing notice cannot be removed or
* amended and must be included in any circumstances where the code snippet is shared by You or a third party."
.findAll { (it as Map).custom } as List<Map>
- // Specify the custom field name below for the Single Line Text Field ensuring the < and > characters are removed.
+ // Specify the custom field names below for the Single Line Text Field ensuring the < and > characters are removed.
def singleLineTextField = customFields.find { it.name == '<SpecifyTheCustomFieldNameHere>' }?.id
+ def numberField = customFields.find { it.name == '<SpecifyTheCustomFieldNameHere>' }?.id
+ def singleSelectListField = customFields.find { it.name == '<SpecifyTheCustomFieldNameHere>' }?.id
// Note in this example we just set the description to null and you will need to specify any extra fields which you wish to have no value in the 'fields' section of the body for the rest call below.
def clearValues = put("/rest/api/2/issue/${issueLink.sourceIssueId}")
description: null, // set the description to have no value
- (singleLineTextField):null // set the single line text field custom field to have no value
+ (singleLineTextField):null, // set the single line text field custom field to have no value
+ (numberField):null,// set the number custom field to have no value
+ (singleSelectListField):null // set the single select list field custom field to have no value