Can not createCopy() on state done ?

Hello all,

I'd like to create a copy of a ticket when it becomes done to create a depending task. But the following code

rule needMarketingText 
 
when State.becomes({Done}) { 
  var nIssue = createCopy(); 
}
prettyPrint();

product the following message when state becomes done

Workflow opale-textsFlow reports error: Transaction is already being flushed!


Is their any work around ?

Thank's in advance
Regards
Yann
5 comments
Comment actions Permalink
Thank you for the feedback, I created the bug JT-21659.

As workaround you can use the method loggedInUser.createNewIssue(project_name):
rule needMarketingText 
 
when State.becomes({Can't Reproduce}) { 
  var newIssue = loggedInUser.createNewIssue(project.shortName); 
  newIssue.summary = summary; 
   
  newIssue.Priority = Priority; 
  newIssue.Type = Type; 
  newIssue.State = {Submitted}; 
  newIssue.Subsystem = Subsystem; 
  newIssue.Assignee = Assignee; 
  newIssue.Fix versions = Fix versions; 
  newIssue.Affected versions = Affected versions; 
  newIssue.Fixed in build = Fixed in build; 
   
}
prettyPrint();
clone.zip (2.6KB)
0
Comment actions Permalink
We've discovered that the method 'createCopy()' is publicly available by mistake. So please use applyCommand("clone"); or loggedInUser.createNewIssue(project.shortName) to achieve issue copying in workflow.

Sorry for inconvenience.
0
Comment actions Permalink
Ok, thanks for the response.
0
Comment actions Permalink

@dmitry The applyCommand("clone") creates an issue with ??? as the issue number (i.e. SL-???). I'm trying to clone a newly issue when it's created and then move it to a different project. 

Can you help me?

0
Comment actions Permalink

Hello Bjorgensen, we can suggest the following: wait until the next release build and then try to use the method copy() instead: https://www.jetbrains.com/help/youtrack/incloud/2017.1/Workflow-Language-Methods.html#copy

Give it a try and then let us know if that helps. Thank you.

0

Please sign in to leave a comment.