- Mark as New
- Follow
- Mute
- Subscribe to RSS Feed
- Permalink
- Email to a Friend
- Report
Hi @montezh2001 - there are quite a few options here and everyone has their favourite.
The solution below is when I have a lot of things in a workflow all wanting to go to a final activity but they all have to finish first. You just use a simple counter that gets incremented whenever the Stop activity is reached. In each Stop, you evaluate if the correct number of "things" has happened (in your case 13). If you get to that number then fire off a signal into the same workflow and run your alert or whatever final thing you want to do. Activities can run whenever they want, but the Alert will only fire when the correct number of things has happened. I like this approach because you don't have to try an make all transitions feed into a single activity (which can get ugly when you have lots of them).
The example below has two activities. The Alert should fire when the first query is either true or false and also when the second query is either true or false. It doesn't care which way the test goes as long as one leg fires on each query.
1. Set up the counter flag into the Start activity Advanced tab :
instance.vars.counterFlag = 0;
// Put in how many deliveries you have here
vars.totalThingsToDo = 2;
2. The code in each Stop activity is:
//increment the counter flag
instance.vars.counterFlag += 1;
//test to see if all activities have been completed
if (instance.vars.counterFlag == vars.totalThingsToDo) {
xtk.workflow.PostEvent("myWorkflowName", "signal", "", <variables />, false);
}
You can just copy and paste the Stop activity once you have set it up
Cheers
Darren