Why is this workflow sending me about 30 emails each morning instead of

There are lots of things wrong with this workflow, but the first one I'm trying to figure it is why it sends me about 30 emails instead of the 1 I anticipated.  The notify is not inside any loops.

daily at 8:00:00 [project=={Agile Implementation}] {
 var output = "Daily Totals: <br>";
 var group = {group:All Users};
 for each u in group.getUsers( ){
  var openIssues = u.getIssues(Everything,"Assignee:"+u);
  var openIssuesCount = 0;
  var InProgressIssuesCount = 0;
  for eachiinopenIssues {
   if(State=={Open}){
    openIssuesCount=openIssuesCount+1;
   }
   if(State=={In Progress}){
    InProgressIssuesCount=InProgressIssuesCount+1;
   }
  }
  output=output+u.fullName+"<vbtab>"+openIssuesCount+"open,";
  output=output+InProgressIssuesCount+"In Progress<br>";
 }
 var usr=project.getUser("Scott");
 usr.notify("Daily Report (test)",output);
}


Sorry it looks like crap, that's how it copies from the youtrack web interface and I can't copy from the workflow editor, so... at least I added some indentations

edit: okay I went back and added some spaces to make it more readable.
0
7 comments
It's because schedule rule is executed on each issue that satisfied condition, in your case project=={Agile Implementation}.
Please also follow the issue JT-10724.
0
Avatar
Permanently deleted user
So there's no workaround?
0
Avatar
Permanently deleted user
Could I do something like

    daily at 8:00 [time == 8:00]

???
0
You can use the condition {issue: A-1} == issue - it means that schedule rule will be executed only for the issue A-1.

And workflow looks like this:
schedule rule test 
 
daily at 08:00:00 [{issue: A-1} == issue] { 
  for each myIssue in project.getUser("root").getIssues(Everything, "project: Agile Implementation") { 
    <define statements> 
  } 
}
0
Avatar
Permanently deleted user
I had to change it from this:

daily at 08:00:00 [{issue: A-1} == issue] {

to this:

daily at 08:00:00 [{A-1} == issue] {

It said it couldn't find issue "issue: A-1".

But it is only sending once now.  Thank you.
0
Avatar
Permanently deleted user
issue: A-1 is a reference to an issue in your project.  However the "A" part will need to be replaced with something more appropriate to your project
If your project is called Agile Implementation this may need to be changed to issue: AI-1 with "AI" being whatever the "Project ID" is set to in your project.
0
Avatar
Permanently deleted user
No, I understand that.  I replaced "A" with my project code (which happened to be "AGI").  I was pointing out that it didn't like the "issue:" part.
0

Please sign in to leave a comment.