We're using fix version to hold a period and Jira to hold and track recurring issues.
Example:
When closing issue 1 - "flush logfiles August" (with fix version August) we need to create issue 2 "flush log files September" (with fix version September)
We're using Scriptrunner postfunction "Clones an issue, and links"
In the "Additional issue Actions" I am already setting some of the fields for issue 2. I would also like to set the fix version of the new issue.
I have created a custom field to hold a mirrored list of fix versions (since its fairly static) so what I want to happen here is that we take the value chosen in cf2 and push that to fix version field on issue2. Not getting it to work though!
------------------------------------------------------------------
import com.atlassian.jira.project.version.Version
import com.atlassian.jira.project.version.VersionManager
import com.atlassian.jira.issue.fields.CustomField
import com.atlassian.jira.component.ComponentAccessor
import com.atlassian.jira.issue.MutableIssue
import java.sql.Timestamp;
MutableIssue myIssue = issue
Timestamp dateField = (Timestamp) cfValues['Förfallodatum nästa kontroll'];
myIssue.setDueDate(dateField);
def cf = customFieldManager.getCustomFieldObjects(issue).find {it.name == 'Utfall'}
issue.setCustomFieldValue(cf, '')
def cf2 = customFieldManager.getCustomFieldObjects(issue).find {it.name == 'Fix Version nästa kontroll'}
issue.setFixVersions(Arrays.asList(cf2))
--------------------------------------------------------------------------