Hi all...I am having an issue updating the Fix Version/s field via a listener in script runner. For some reason the line that actually set the Fix Version/s field is not executing, so the the Fix Version/s field is not being updated. I am getting the correct string for the version I want to update the Fix Version/s field to and the version is indeed defined as a version for the project, but still the field is not being updated. This line seems to be doing what is expected to do, which is actually to update the Fix Version/s field:
issue.setFixVersions([versionFX])
I have tried a couple of suggestions from two of the techies from Adaptavist but none worked.
Thank you for your assistance!
Here is the complete script:
import com.atlassian.jira.component.ComponentAccessor;
import com.atlassian.jira.issue.CustomFieldManager
import com.atlassian.jira.ComponentManager;
import com.atlassian.jira.issue.Issue
import com.atlassian.jira.project.Project
import com.atlassian.jira.project.version.Version
import com.atlassian.jira.project.version.VersionManager
def change = event?.getChangeLog()?.getRelated("ChildChangeItem").find {it.field == "Target Release"}
if (change) {
def customFieldManager = ComponentAccessor.getCustomFieldManager()
VersionManager versionManager = ComponentAccessor.versionManager
Issue issue = event.issue
def key=issue.getKey()
Object plugin = ComponentAccessor.getPluginAccessor().getPlugin("com.valiantys.jira.plugins.SQLFeed");
Class serviceClass = plugin.getClassLoader().loadClass("com.valiantys.nfeed.api.IFieldDisplayService");
ComponentManager componentManager = ComponentManager.getInstance();
Object fieldDisplayService = componentManager.getOSGiComponentInstanceOfType(serviceClass);
Object displayResult = fieldDisplayService.getDisplayResult(key, "customfield_12100");
String display = ""
display = displayResult.getDisplay();
log.warn("display: " + display)
Project project = issue.getProjectObject()
Version versionFX = versionManager.getVersion(project.getId(), display as String)
log.warn("versionFX: " + versionFX)
//def versions = issue.getFixVersions()
//log.warn("current versions: " + versions)
//versions.add(versionFX)
//log.warn("appended versions: " + versions)
issue.setFixVersions([versionFX])
}else
log.warn("no change of Target Release")
return
Hi Tomas,
I believe @Ashraful Hasan [Adaptavist] answered your question through our support portal. You no longer need help with this, correct? Feel free to post the script here if you'd like to share it with others. :)
Regards,
Josh
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.