I am attempting to to clone an issue as part of a workflow post-function using Scriptrunner (v4.3.16) on Jira Software (v7.1.1), running against MS SQL Server 2008. I have hit a problem with database connections going crazy, bringing down Jira. This looks to be the issue reported in https://jira.atlassian.com/browse/JRASERVER-60928.
At some point while developing the script, it worked fine. Then I added more logic to set particular custom field values on the new issue, and it broke. I'm not exactly sure when it broke though.
While I investigate the database level workaround described on JAC, can anyone advise on any particular functions I should avoid in my script to get round the problem?
This is my code from additional issue actions:
import com.onresolve.scriptrunner.runner.util.UserMessageUtil import com.atlassian.jira.project.version.Version import com.atlassian.jira.component.ComponentAccessor import com.atlassian.jira.issue.customfields.manager.OptionsManager import com.atlassian.jira.issue.label.LabelManager //Don't clone links checkLink = {link -> false}; //Don't clone attachments checkAttachment = {attachment -> false}; //Get the XXX field and put XXX1 in it. XXX is a multi-select field //I'm fairly sure this part worked fine def xxx = customFieldManager.getCustomFieldObjects(issue).find {it.name == 'XXX'}; def xxxfieldconfig = xxx.getRelevantConfig(issue) def xxxoption = ComponentAccessor.optionsManager.getOptions(xxxfieldconfig)?.find { it.toString() == 'XXX1' } issue.setCustomFieldValue(xxx, [xxxoption]); //Get the YYY field and put "YYY1" in it - YYY is a select (single) field def yyy = customFieldManager.getCustomFieldObjects(issue).find {it.name == 'YYY'}; def yyyfieldconfig = yyy.getRelevantConfig(issue) def yyyoption = ComponentAccessor.optionsManager.getOptions(yyyfieldconfig)?.find { it.toString() == 'YYY1' } issue.setCustomFieldValue(yyy, yyyoption); //Get the ZZZ status field and clear it - ZZZ is a select (single) field def zzz = customFieldManager.getCustomFieldObjects(issue).find {it.name == 'ZZZ'}; issue.setCustomFieldValue(zzz, null); //Put AAA in the affects version Version version = ComponentAccessor.getVersionManager().getVersion(issue.getProjectId(), 'AAA'); issue.setAffectedVersions([version]); //Stick "CLONE" on the front of the summary issue.summary = '[CLONE] -' + sourceIssue.summary //Have to do this after issue creation for some reason doAfterCreate = { //Put BBB label on the issue def user = ComponentAccessor.jiraAuthenticationContext.getLoggedInUser() LabelManager labelManager = ComponentAccessor.getComponent(LabelManager) def bbblabel = 'BBB' labelManager.addLabel(user,issue.id,bbblabel,false) } UserMessageUtil.success('TEST MESSAGE')
Thanks in advance
Neil
Following up my own post...
Would I avoid this problem if, instead of scripting the clone as part of the workflow transition, I instead did it as a Scripted Listener?
(Don't have a test environment available right now, and don't want to try it out and bring down Jira again)
Hi Neil,
You script seems fine to me. Actually my question is in which step is your post function and also it's order among the other post functions.
regards, Thanos
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
Hi Thanos
It's a completely bespoke workflow, with statuses Open, Review, Release, Testing and Closed. The transitions are fairly flexible, but the typical path of an issue is Open > Review > Open > Release > Testing > Closed.
The clone post-function is on the Open > Release transition.
I've remove the clone function now, but i'm fairly sure it was in the default position (i.e. first) compared to the existing post-functions. So it would have been:
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
Hi Thanos. Did the information I provided above give any clues as to what the problem might be?
Thanks
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
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.