Custom issue links can not be added via workflow rule

I have the following rule defined that should be creating a ticket in another project and then adding my custom link "implemented with".

var issueReporter = issue.reporter; 
if (Type.name.startsWith("DB:", opts)) { 
  var ticket = issueReporter.createNewIssue("DBSTASK"); 
  ticket.Charge Code = Charge Code; 
  ticket.Sprint = Sprint; 
  ticket.summary = "[" + Project Key + "] " + summary; 
  ticket.description = "sub-board element."; 
  ticket.Due Date = Due Date; 
   
  implemented with.add(ticket); 
   
  message("Created implementation ticket <a href='" + ticket.getUrl() + "'>" + ticket.getId() + "</a>!"); 
}


If i change the line "implemented with.add(ticket)"   to "depends on.add(ticket)"... the workflow rule behaves as expected and created the issue link. With my custom link, i get the following error when i try to upload (or force upload) the workflow from the WE:
error executing script 'CollectRequirements' (jetbrains.youtrack.workflow.generator.template.requirements@generator) (see exception)
exception -> "java.lang.NullPointerException"

Double-clicking in the error on Workflow Editor show me this:
mapping script CollectRequirements        
            
script kind : pre-process input model     
modifies model : true      
            
(model, genContext, operationContext)->void { 
  model.roots(IRule).where({~it => !(it.requirementsDisabled); }).forEach({~it => it.collectRequirementsx(); }); 
}


PS - I've also tried to create the issue link from the ticket variable (the other way).
5 comments
Comment actions Permalink
Could you please attach idea.log file located in user_home/.youtrack4.0/system/log?
0
Comment actions Permalink

[idea.log] the idea.log file is attached.
0
Comment actions Permalink
Please attach idea.log file one more time.
0
Comment actions Permalink
Here's the relevant error from the log:

2014-02-20 12:23:00,439 [252184557]   INFO - jetbrains.mps.smodel.DefaultSModelDescriptor - Saving model mmg-v2-trb
2014-02-20 12:23:20,338 [252204456]   INFO - jetbrains.mps.smodel.DefaultSModelDescriptor - Saving model mmg-v2-trb
2014-02-20 12:23:20,537 [252204655]  ERROR - jetbrains.mps.util.QueryMethodGenerated - java.lang.NullPointerException
java.lang.NullPointerException
java.lang.NullPointerException
 at jetbrains.youtrack.workflow.generator.template.util.TypeRequirementBuilder.getFieldLazy(TypeRequirementBuilder.java:156)
 at jetbrains.youtrack.workflow.generator.template.util.RuleRequirementBuilder.addFieldType(RuleRequirementBuilder.java:112)
 at jetbrains.youtrack.workflow.generator.template.util.RuleRequirementBuilder.addFieldReference(RuleRequirementBuilder.java:64)
 at jetbrains.youtrack.workflow.generator.template.util.RuleRequirementBuilder.getRequirements(RuleRequirementBuilder.java:30)
 at jetbrains.youtrack.workflow.generator.template.util.RequirementsUtil.collectRequirements(RequirementsUtil.java:24)
 at jetbrains.youtrack.workflow.generator.template.requirements.QueriesGenerated$1.visit(QueriesGenerated.java:23)
 at jetbrains.youtrack.workflow.generator.template.requirements.QueriesGenerated$1.visit(QueriesGenerated.java:21)
 at jetbrains.mps.internal.collections.runtime.IVisitor.invoke(IVisitor.java:14)
 at jetbrains.mps.internal.collections.runtime.IterableUtils.visitAll(IterableUtils.java:17)
 at jetbrains.mps.internal.collections.runtime.Sequence.visitAll(Sequence.java:85)
 at jetbrains.youtrack.workflow.generator.template.requirements.QueriesGenerated.mappingScript_CodeBlock_305052876677150056(QueriesGenerated.java:17)
 at sun.reflect.GeneratedMethodAccessor335.invoke(Unknown Source)
 at sun.reflect.DelegatingMethodAccessorImpl.invoke(Unknown Source)
 at java.lang.reflect.Method.invoke(Unknown Source)
 at jetbrains.mps.util.QueryMethodGenerated.invoke(QueryMethodGenerated.java:127)
 at jetbrains.mps.generator.impl.interpreted.TemplateMappingScriptInterpreted.apply(TemplateMappingScriptInterpreted.java:67)
 at jetbrains.mps.generator.template.DefaultQueryExecutionContext.executeScript(DefaultQueryExecutionContext.java:350)
 at jetbrains.mps.generator.impl.GenerationSession.preProcessModel(GenerationSession.java:448)
 at jetbrains.mps.generator.impl.GenerationSession.executeMajorStepInternal(GenerationSession.java:286)
 at jetbrains.mps.generator.impl.GenerationSession.executeMajorStep(GenerationSession.java:271)
 at jetbrains.mps.generator.impl.GenerationSession.generateModel(GenerationSession.java:163)
 at jetbrains.mps.generator.impl.GenerationController$1.compute(GenerationController.java:209)
 at jetbrains.mps.generator.impl.GenerationController$1.compute(GenerationController.java:206)
 at jetbrains.mps.generator.impl.GeneratorUtil.runReadInWrite(GeneratorUtil.java:161)
 at jetbrains.mps.generator.impl.GenerationController.generateModel(GenerationController.java:206)
 at jetbrains.mps.generator.impl.GenerationController.generateModelsInModule(GenerationController.java:151)
 at jetbrains.mps.generator.impl.GenerationController.generate(GenerationController.java:100)
 at jetbrains.mps.generator.GeneratorManager$2$1.compute(GeneratorManager.java:114)
 at jetbrains.mps.generator.GeneratorManager$2$1.compute(GeneratorManager.java:111)
 at jetbrains.mps.ide.undo.WorkbenchUndoHandler.runNonUndoableAction(WorkbenchUndoHandler.java:47)
 at jetbrains.mps.smodel.UndoHelper.runNonUndoableAction(UndoHelper.java:61)
 at jetbrains.mps.generator.GeneratorManager$2.run(GeneratorManager.java:111)
 at jetbrains.mps.ide.smodel.WorkbenchModelAccess$8.compute(WorkbenchModelAccess.java:303)
 at jetbrains.mps.ide.smodel.WorkbenchModelAccess$8.compute(WorkbenchModelAccess.java:299)
 at com.intellij.openapi.application.impl.ApplicationImpl$10.run(ApplicationImpl.java:798)
 at com.intellij.openapi.application.impl.ApplicationImpl.runReadAction(ApplicationImpl.java:757)
 at com.intellij.openapi.application.impl.ApplicationImpl.runReadAction(ApplicationImpl.java:796)
 at jetbrains.mps.ide.smodel.WorkbenchModelAccess.tryRead(WorkbenchModelAccess.java:299)
 at jetbrains.mps.ide.smodel.WorkbenchModelAccess.requireRead(WorkbenchModelAccess.java:347)
 at jetbrains.mps.generator.GeneratorManager.generateModels(GeneratorManager.java:108)
 at jetbrains.mps.lang.core.plugin.Generate_Facet$Target_generate$1.execute(Generate_Facet.java:618)
 at jetbrains.mps.internal.make.runtime.script.Script$3.invoke(Script.java:280)
 at jetbrains.mps.internal.make.runtime.script.Script$3.invoke(Script.java:223)
 at jetbrains.mps.workbench.make.WorkbenchMakeService$Controller.runJobWithMonitor(WorkbenchMakeService.java:397)
 at jetbrains.mps.internal.make.runtime.script.Script.executeTargets(Script.java:223)
 at jetbrains.mps.internal.make.runtime.script.Script.execute(Script.java:213)
 at jetbrains.mps.make.service.MakeTask.doRun(MakeTask.java:200)
 at jetbrains.mps.make.service.MakeTask.access$100(MakeTask.java:39)
 at jetbrains.mps.make.service.MakeTask$1.run(MakeTask.java:85)
 at java.lang.Thread.run(Unknown Source)
0
Comment actions Permalink
Thank you for the logs, I guess the following workaround should work for you:
  1. set cursor onto the 'rule' or the 'when' word of the workflow rule
  2. press Alt+2 or click 'Inspector' on the right bottom corner
  3. find text 'do not generate requirements: false'
  4. change 'false' to 'true'

It tells to the Workflow Editor not to generate field/value/links/etc requirements.

Please attach your workflow and provide fields and links scheme for the investigation.
0

Please sign in to leave a comment.