workflow changes do not trigger other workflow

I have a workflow that is triggered when a 'depends on' link is added to an issue. This works fine when I add the link manually. However when I add the 'depends on' link from another workflow, nothing happens (the 'depends on' link is there afterwards, but the workflow is not triggered).

Is this a bug, or is this by design?

(the documentation suggest it should be possible to have a chain of workflows).
11 comments
Comment actions Permalink
Please see JT-27921, is it your case?
0
Comment actions Permalink
No, I am still on YouTrack 5.2.5.
0
Comment actions Permalink
Well, please provide the code of both workflows.
0
Comment actions Permalink
The setup is a project containing software items (shortname SW), linking (using 'parent for') to other projects containing the users. Upon linking a new SW issue to another SW issue using 'depends on', the idea is that all the users from the other SW issue are 'cloned' and linked to the new SW issue. This part works well and is done by the following code:

rule add ongoing software users when linking using depends on 
 
when depends on.added.first != null { 
  var dpdnt = depends on.added.first; 
  var cnt = 0; 
  for each usr in dpdnt.parent for { 
    if (!usr.isResolved()) { 
      var newUsr = loggedInUser.createNewIssue(usr.project.shortName); 
      newUsr.summary = usr.summary; 
      newUsr.description = usr.description; 
      newUsr.subtask of.add(issue); 
      // delegate the 'cloning' of the users to a specific workflow in the user project, 
      //  triggered by the adding of the depends on relation 
      newUsr.applyCommand("depends on " + usr.getId()); 
      cnt = cnt + 1; 
    } 
  } 
  if (cnt > 10) { 
    message("Cloned " + cnt + " users from dependent software <a href=\"" + dpdnt.getUrl() + "\">" + dpdnt.getId() + "</a>"); 
  } 
}
prettyPrint();

Then in the user project for that particular software (multiple projects for each software item), a rule should copy the fields specific for that software. E.g.

rule when depends on another item in same project (e.g. GW), copy field values 
 
when depends on.changed && depends on.added.first != null { 
  // this workflow is a way to clone user project items 
  // triggered by the workflow for copying the users to a new software license 
  // specific to the fields present in a specific user project (e.g. GW) 
  var usr = depends on.added.first; 
  message("Trying to clone " + usr.getId() + " to " + issue.getId()); 
  if (usr.project == project) { 
    State = usr.State; 
    Email = usr.Email; 
    End date = usr.End date; 
    License type = usr.License type; 
    License Cost = usr.License Cost; 
  } 
}
prettyPrint();

This rule works well when triggered by manually linking two user issues with 'depends on', but is not triggered when the first rule is triggered.

Could it have something to do with the fact that the issues are from different projects?

Thanks for looking into it!
0
Comment actions Permalink
Try to use newUsr.depends on.add(usr) instead of the command applying.
Also the depends on.changed condition looks redundant.
0
Comment actions Permalink
Already did that! Both things are there because I hoped it would make a difference.
0
Comment actions Permalink
Once an Automation workflow starts, you can't make changes to the list, workflow type, or email order, because these make up the foundation of your workflow.
0
Comment actions Permalink
you can't make changes to the list

I'm not sure I understand what you mean by this, and how that applies to my problem. I'm assuming you saw something in my workflow code that does that? Could you indicate which commands? Thanks!
0
Comment actions Permalink
Could you please change the condition of your second rule to:

when (!(isReported()) || depends on.changed) && depends on.added.first != null
prettyPrint();
Does it help?
0
Comment actions Permalink
That does indeed solve it! Thanks!

So do I understand correctly that somehow the depends on.changed is not true when a node is not reported, despite the fact that depends on.added contains items?

This brings me to another question: when a workflow is running and it changes things that trigger other workflows. Are these workflows triggered immediately (and running in parallel) or are they scheduled, or is the triggering only done after the workflow ended?
0
Comment actions Permalink
I spoke too soon (checked the wrong thing), so unfortunately this was not solved by the change. Can I ask what the idea behind this suggestion was?
0

Please sign in to leave a comment.