Friday, 14 March 2014

Scenario 14: How to send a notification for long running Workflow/Sessions?

Scenario 14: How to send notification for long running workflow/sessions?

Ex: If particular workflow is running for longer than specified time then we need to send a notification to concern team.
This solution helps Production Support fellows a lot. They escaped from being a watch dog.

Let's Chat: There are several approach for this and unfortunately every approach has some drawback. It's totally depends upon your requirement that with which drawback you are good or which approach is getting approval from Solution Review Meeting. :-(

Scenario is crystal clear and yes, we need Timer task to handle this but we have to look after about few case so, let's talk about case first.

CASE 1: If workflow (Sessions) exceeds it's specified time of running send a mail.
CASE 2: If workflow (Sessions) completed within specified time then we need to stop timer


Step 1:
Create a Timer in concurrent manner so, that timer starts immediately after starting workflow. (See Image Below)
Set Relative time
DAY      HH      MM
0             1          30

Note: Expected time to complete workflow is 1:30 Hrs from time of starting.

Step 2:
Create a Email Task.
Email User Name: 24*7
Email Subject: Workflow is going beyond our control
Email Text: Wake Up, Dude. It's your turn now.

Step 3: 
Create a Control Task at the end of your workflow execution pipeline. (See Image Below)
Set Control Option: Stop top-level workflow

Note: To test this solution please, reduce the time of timer keep lower than time taken by workflow to complete.


Drawback of Approach: Your Workflow and Timer Status will be as Stop not as Succeeded, if workflow completes within specified time.

Do you want me to explain another approach also, which we have opted in our project? If yes, then leave me a comment :-) ha ha ha, It seems now I have started blackmailing... No need to do this my friend, I am working on that approach also and will post it soon. I want your comments through your heart not from your mind. Thanks.

Feel free to post your doubt in comment section.

Due to limitation, I can't attach exported .xml file which you can Import in your repository and see or analyse. (Feel free to mail me if you need .xml file with Scenario number and Question.)

If you like the approach and solution feel free to share with others.



  1. Hey Harsh,
    Good one. Plz share the other approach also.

  2. Hey Harsh,
    Why do we need control task?

    1. This comment has been removed by the author.

  3. The timer will keep running even if the session succeeds within the specified time, and hence the workflow will remain in the running state even after the session completes execution. So to stop the workflow as soon as the session succeeds the Control task is used with option "Stop top level workflow". Hope it helps.