starting workflow with event handler... help!



    I have a task list where tasks are added by a workflow process. we wanted a way of monitoring that tasklist to send reminders if these tasks become more than 5 days overdue.


    I am in the process of creating another workflow to do this monitoring. The workflow will be started by an eventhandler on itemadded and a taskoverdue check is done, if the task isnt overdue the workflow sleeps and wakes up again 24 hours later.


    My event handler works perfectly and i can enter my monitoring workflow code. The monitoring workflow will be written in visual studio 2005 using the sharepoint sequential workflow template. My problem is how do i get the monitoring workflow to detect the task with which it is associated?


    In my event handler i use the following code to start the workflow:



    Code Snippet
    if (item.Workflows.Count == 0)         
                            SPWorkflowManager wfmgr = item.Web.Site.WorkflowManager; 
                            SPWorkflowAssociationCollection wfassoccol = item.ParentList.WorkflowAssociations;             
                            foreach (SPWorkflowAssociation wfassoc in wfassoccol)            
                                //Loop through all workflows on the list, find the GUID for the EMEAOverdueTaskEscalation and start that one            
                                //NB: this guid is held in the workflow.xml file of the EMEAOverdueTaskEscalation WF.
                                if (String.Compare(wfassoc.BaseId.ToString("B"), "{a84f6142-6fef-4aa7-90b3-9a70752e4d70}", true) == 0)                
                                    wfmgr.StartWorkflow(item, wfassoc, "", true);                



    so i am passing to the workflow i am calling the item with which i should be associated. But how do i then code the actual monitoring workflow so it picks up this information? I am currently trying to find it in Microsoft.SharePoint.Workflow.SPWorkflowActivationProperties but Im not getting anywhere.


    All my information for where i am at so far has been gained form a combination of the following blogs as i have never done any workflow stuff before:


    monitoring workflow (i have disregarded the part where the new task is created as this is already done in my case)


    event handler part:


    am i on the right track or WAY off? Hope someone can help!



    Thursday, June 26, 2008 9:26 AM