Expand my Community achievements bar.

SOLVED

Alert - Workflow Complete

Avatar

Level 4

All, 

 

I have a situation that requires me to create an alert when a workflow completes successfully. The workflow runs daily and contains 13 deliveries (based on segmentation in the workflow); not all will send. I tried putting all the delivery transitions into and And-Join and then straight to an Alert Activity, but realized that if no records are found during segmentation for a delivery, then I have them going straight to an END activity. 

 

Is there a way to send an email that when the workflow is complete for the day, I can send an email to Assignee's letting them know the workflow ran successfully for the day? Or, do I have to set up an alert for each Delivery (Success) and End (No Records Available)?

 

I would like it to work similar to how the Error alert works - meaning when a workflow fails, a group I assigned is notified. 

 

Please advise. 

1 Accepted Solution

Avatar

Correct answer by
Level 9

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

Darren_Bowers_0-1626047282806.png

Cheers

Darren

 

View solution in original post

2 Replies

Avatar

Correct answer by
Level 9

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

Darren_Bowers_0-1626047282806.png

Cheers

Darren

 

Avatar

Level 4

@Darren_Bowers Thank you for this; this works and it phenomenal.