locked
Sharepoint Custom Workflow built in VS 2008 using Sequential Workflow Template Problem RRS feed

  • Question

  • Hi,

    I created a custom sequential workflow in VS 2008. We have Moss 2007. This is a simple test workflow which creates a task and waits on the task in a while loop to see if the task is still pending. If the task moves from pending state to Approved State or Rejected State then it creates another task and completes. This works fine when I run it on one item. But if I run this workflow for example on 2 items at the sametime, same workflow is running on 2 items here..It creates the task associated to each item and when I modify the task associated to first item and make it as approved then it is creating another task and workflow is completing..but the samething is happening for the second item which is waiting in the while loop on OnTaskModified Event. onTaskModified Event is run for the second item also when I modify the first task.

    I dont know why this is happening..The workflow that runs on one item should be independent  of another right?

    Appreciate your help..


    rani
    Thursday, September 15, 2011 4:09 PM

Answers

  • Hi rani,

    According to your description, my understand is that you have a workflow run on two items, so there is two workflow instances, and when the task created by the first workflow instance been modified, both of the OnTaskChanged activityies in two running workflow instances will be fired. If I misunderstood you, please feel free to let me know.

    This seems very strange,could you post your code so we could do some further research?

    In my opinion, some possible reason is that you did not bind your taskId properly.
    I suggest you using the sample code below to create a new task and make sure the OnTaskChanged activity's taskID will bind to the corresponding CreateTask activity's TaskId.

        TaskId1 = Guid.NewGuid();  //use a new guid
       TaskProperties1 = new SPWorkflowTaskProperties();  //use a new SPWorkflowTaskProperties();   
                //other code
    

    Thanks,
    Simon

    Wednesday, September 21, 2011 12:07 PM