none
Best way to get alerts on overdue workflow tasks?

    Question

  • Apologies if this is in the wrong place, but i wasnt sure where else to put this question.

     

    My problem:

     

    I have been asked to solve the problem of sending email reminders for overdue tasks created for a person in the task list of our workflows. Each of our workflows are hosted in their own sharepoint site, the workflow engine is a bespoke system written in c# with WWF at its core by our US team. The user interface for the workflow is an infopath form.

     

    What is required is that when a task created by the workflow and assigned to a person is overdue, a reminder be sent out on email for that person. Sharepoint alerts out of the box dont cover the requirement (i dont think, unless im missing something) as it is required that the reminder is emailed EVERYDAY for the task being overdue and also that the email contains a "rollup" of the recipients overdue tasks. That is to say, a reminder for every overdue task in that particular workflow for the person in question is sent in one email, once a day.

     

    I have looked around for solutions to this and seen some 3rd party things like sharepoint reminder and bamboo alert plus. But generally speaking my company prefers in house solutions rather than 3rd party tools. Also from reading around this rather vast subject i have yet to come to the conclusion of the best way to solve this... do i create another workflow in VS2005 (state machine workflow?) do I create a feature in sharepoint? do i design a workflow in sharepoint designer? do i try to amend our existing workflow engine (a solution which the US team dont think is satisfactory).

     

    Obviously we want one solution that can simply be "plugged in" to any or all of the workflows in sharepoint that we have (or will have) running and will pick up the task list, loop round the tasks and create the email reminders.

     

    this is my directive from the US:

    I think we need a totally separate project/application to perform this unit of work.  Features it needs to take into consideration:

     

    Must haves 

    ·         Process as well as step specific configuration for reminders:

    o   Time interval on when to send out the reminder

    o   Users/Groups who should get notified

     

    Nice to haves 

    ·         Configurable email subject/body

    ·         Ability to insert some process/task specific information into the reminder email

    ·         Notification “roll-up”  -  People don’t like getting dozens of reminders a day about things.  This will quickly turn into a nuisance feature.

     

    (I think the notification roll-up is actually a must have!!) Has anyone got any advice, good sites for solutuions/code snippets to help me find the right way to solve this please?

     

    Hope someone can help/advise

    Friday, May 16, 2008 1:05 PM

All replies

  • You might consider using KPIs instead.  If a task is overdue, show red.  If it's due "soon", show amber.  Otherwise show green.

     

    That can be a real time indicator that doesn't "go away" and can never be forgotten.

     

     

    Saturday, May 17, 2008 9:56 PM
  • Paul,

     

    Thanks for your reply. Interesting idea, but the customers have specifically asked that email reminders be sent when we have discussed requirements on specific workflows. I think the reasoning behind this is that a person who has a task assigned may not regularly check the sharepoint task list...if they are an approver for a credit note (for example) the likelihood is that they will get many documents assigned for approval and wont respond to them all immediately.

     

    Your idea makes sense, but im pretty sure it wont fly with our customers.

     

    Any other suggestions?

    Monday, May 19, 2008 8:13 AM
  • Found this:

    http://blogs.msdn.com/publicsector/archive/2007/11/01/how-to-video-programmatically-escalating-an-overdue-task-document-workflow-in-sharepoint-moss-2007.aspx

     

    haven't worked through it yet, but could be the solution im looking for. Just throwing it up here so anyone else with same problem who stumbles across this thread can see it.

     

    cheers

    Monday, May 19, 2008 10:05 AM
  • Had same request, used same example – but after day or so I was unhappy with solution I was able to develop.

    So I tried different approach: custom Timer Job that checks all task lists on desired site for overdue tasks and sends custom summary e-mails to users. That is much better solution than using extra workflow for overdue tasks (my opinion).

    Monday, June 01, 2009 9:11 AM
  • Hi,

    I have the the same requirements for my custom workflow - I should send e-mails when task are overdue. I was thinking the same way - I created a timer job which runs every night.
    At the moment I've the problem, that I don't know who to get all task items which were created from a specific (custom) workflow. Do you have an idea how I could get the items?

    Thanks in advance
    Thursday, August 06, 2009 8:40 AM
  • Hi,

    I have the the same requirements for my custom workflow - I should send e-mails when task are overdue. I was thinking the same way - I created a timer job which runs every night.
    At the moment I've the problem, that I don't know who to get all task items which were created from a specific (custom) workflow. Do you have an idea how I could get the items?

    Thanks in advance

    In my solution I am checking all tasks in workflow task list.
    If you want use just tasks from specific workflow my guess is that you need to use some CAML query for filtering task list by WorkflowInstanceID.
    You can also go the other way around and find running workflow and then check for its tasks.

    Maybe you can start with this blog: http://mossytips.blogspot.com/2008/08/how-to-get-workflow-instance-of-task.html
    Thursday, August 06, 2009 12:44 PM
  • Hi,

    I have also got the same requirement.That is sending mail notofication for over due task who are CC'd.

    For this i have written Custom Timer JOb.Here i am sending mail notofication to CC'd for every 5 mnts.

    The problem is mail was sending twice.Two times mail was going to CC'd.Here i am providing the code.

    Plaese help me where the problem in my code.

    using

    System;

    using

    Microsoft.SharePoint;

    using

    Microsoft.SharePoint.Administration;

    using

    Microsoft.SharePoint.Utilities;

    using

    Microsoft.SharePoint.Workflow;

    using

    System.Xml.Linq;

    using

    System.Collections.Generic;

    using

    System.Text;

    using

    System.Xml.Serialization;

    using

    System.IO;

    using

    Microsoft.SqlServer.Server;

    using

    System.Xml;

    using

    System.Linq;

    namespace

    AndrewConnell.TaskLogger

    {

     

    public class TaskLoggerJob : SPJobDefinition

     

    {

     

    public string siteName = string.Empty;

     

    public static bool flag = false;

     

    //public string loginName = string.Empty;
     

     

    /// <summary>
     

     

    /// Initializes a new instance of the TaskLoggerJob class.
     

     

    /// </summary>
     

     

    public TaskLoggerJob()

    :

    base()

    {

    }

     

    /// <summary>
     

     

    /// Initializes a new instance of the TaskLoggerJob class.
     

     

    /// </summary>

     

    /// <param name="jobName">Name of the job.</param>

     

    /// <param name="service">The service.</param>

     

    /// <param name="server">The server.</param>

     

    /// <param name="targetType">Type of the target.</param>

     

    public TaskLoggerJob(string jobName, SPService service, SPServer server, SPJobLockType targetType)

    :

    base(jobName, service, server, targetType)

    {

    }

     

    /// <summary>

     

    /// Initializes a new instance of the TaskLoggerJob class.

     

    /// </summary>

     

    /// <param name="jobName">Name of the job.</param>

     

    /// <param name="webApplication">The web application.</param>

     

    public TaskLoggerJob(string jobName, SPWebApplication webApplication)

    :

    base(jobName, webApplication, null, SPJobLockType.ContentDatabase)

    {

     

    this.Title = jobName;

    }

     

    /// <summary>

     

    /// Executes the specified content db id.

     

    /// </summary>

     

    /// <param name="contentDbId">The content db id.</param>

     

    public override void Execute(Guid contentDbId)

    {

     

     

    using (SPSite spSite = new SPSite("http://usdam-luaptw10/DemoTest/"))

    {

     

    using (SPWeb web = spSite.OpenWeb())

    {

     

    // get a reference to the "Tasks" list in the RootWeb of the first site collection in the content database

     

    SPList taskList = web.Lists["Tasks"];

     

    SPQuery oQuery = new SPQuery();

    oQuery.Query =

    "<Where><Eq><FieldRef Name='Status'/>" +

     

    "<Value Type='Text'>Not Started</Value></Eq></Where>";

     

    SPListItemCollection collListItems = taskList.GetItems(oQuery);

     

     

    foreach (SPListItem oListItem in collListItems)

    {

    AssosiationData(web, oListItem);

     

    //Console.WriteLine(SPEncode.HtmlEncode(oListItem["Title"].ToString()));

    }

     

     

    }

    }

    }

     

    private static void AssosiationData(SPWeb spWeb, SPListItem oListItem)

    {

     

    string TASK_LIST_WORKFLOW_INSTANCE_ID = oListItem[SPBuiltInFieldId.WorkflowInstanceID].ToString();

     

    string TASK_LIST_WORKFLOW_LIST_ID = oListItem[SPBuiltInFieldId.WorkflowListId].ToString();

     

    int TASK_LIST_WORKFLOW_ITEM_ID = Convert.ToInt32(oListItem[SPBuiltInFieldId.WorkflowItemId]);

     

    Guid sourceListID = new Guid(TASK_LIST_WORKFLOW_LIST_ID);

     

    SPList sourceList = spWeb.Lists.GetList(sourceListID, true);

     

    int sourceListItemID = TASK_LIST_WORKFLOW_ITEM_ID;

     

    SPListItem sourceListItem = sourceList.GetItemById(sourceListItemID);

     

    //Get the workflow instance id from Task item

     

    Guid taskWorkflowInstanceID = new Guid(TASK_LIST_WORKFLOW_INSTANCE_ID);

     

    //Get the workflow object

     

    SPWorkflow wf = sourceListItem.Workflows[taskWorkflowInstanceID];

     

    //Get the workflow association object

     

    SPWorkflowAssociation wfAss = sourceList.WorkflowAssociations[wf.AssociationId];

     

    try

    {

     

    //Check if the associated workflow is of type Approval

     

    if (wfAss.Name.Equals("Demo"))

    {

     

    SendEmailActivity(spWeb, oListItem, wfAss);

    }

    }

     

    catch (ArgumentException argex)

    {

    }

    }

     

    private static void SendEmailActivity(SPWeb spWeb, SPListItem oListItem, SPWorkflowAssociation wfAss)

    {

     

    string ns = "{http://schemas.microsoft.com/office/infopath/2003/myXSD}";

     

    XDocument xdoc = XDocument.Parse(wfAss.AssociationData);

     

    string loginName = xdoc.Descendants(ns + "CC").Descendants(ns + "AccountId").First().Value;

     

    SPUser spUser = spWeb.ParentWeb.AllUsers[loginName];

     

    SPUtility.SendEmail(spWeb, false, false, spUser.Email, "Workflow Notification", "Workflow is pending state: " + oListItem.Title.ToString());

    }

    }

    }

    Can anyone please help me what the problem with code.Mail was going two times.

    siddarth

     

     

     

    Tuesday, January 24, 2012 9:43 AM