Problem in editing a completed task

Aug 6, 2010 at 3:24 PM

I'm having a strange behaviour in editing a completed task...

If i edit a task that is already completed it always open the form of the first task.... I check the url and the id of the task is ok, but the form is from the first task of the workflow.

Anyones had this problem before?

Thanks!!

 

Coordinator
Aug 9, 2010 at 1:27 AM

When you say the first talk in the workflow are you talking about two different task items that are created at different places in the process or is this a single task that has multiple stats in the UI?

Chris

From: javieruy [mailto:notifications@codeplex.com]
Sent: Sunday, August 08, 2010 5:27 PM
To: chris@predeekconsulting.net
Subject: Problem in editing a completed task [wss3workflow:222737]

From: javieruy

I'm having a strange behaviour in editing a completed task...

If i edit a task that is already completed it always open the form of the first task.... I check the url and the id of the task is ok, but the form is from the first task of the workflow.

Anyones had this problem before?

Thanks!!

Read the full discussion online.

To add a post to this discussion, reply to this email (wss3workflow@discussions.codeplex.com)

To start a new discussion for this project, email wss3workflow@discussions.codeplex.com

You are receiving this email because you subscribed to this discussion on CodePlex. You can unsubscribe or change your settings on codePlex.com.

Please note: Images and attachments will be removed from emails. Any posts to this discussion will also be available online at codeplex.com

Aug 9, 2010 at 2:47 AM

My workflow has 3 level of approval like this

CreateTask1->OnTask1Changed->Task1Completed->CreateTask2->OnTask2Changed->Task2Completed->CreateTask3->OnTask3Changed->Task3Completed.

When the task are all completed, if i edit the task2 the task1 form is open, if i edit the task3 form the task1 form is open, remember this only happens when the task are completed.

Aug 19, 2010 at 12:28 PM

Hi, i have been debugging your application and I realized what is the problem....

Fist an updat to the problem, when a i have more than one task in my workflow and someone wants to edit a completed task, it opens the user control associated with the first task, the one with TaskType 0.

Here is the source of the problem, on the TaskFormHost.cs class

 

protected void PlaceHolder_CreatingControl(object sender, EventArgs e)
{
            WorkflowControlPlaceHolder placeHolder = sender as WorkflowControlPlaceHolder;
            int taskType = (int)base.ListItem[SPBuiltInFieldId.TaskType];  //When the task is completed it always return false.
            placeHolder.PlaceHolderType = taskType.ToString(CultureInfo.InvariantCulture);
 }

The problem is the line:

 int taskType = (int)base.ListItem[SPBuiltInFieldId.TaskType];

When a task is completed this returns always 0, this is because sharepoint cleans all the properties of the task once it is completed.

The problem I have with this is i am sending mails wiht the url of tasks, if someone click on a url associated with a task that it is completed, it opens the user control of the first task and it is very confusing. I could redirect to error page, if the task is completed, but it would be nice if it opens the correct user control. One thing you can do is not using the field ListItem[SPBuiltInFieldId.TaskType]; create your own field on your content type to store the correct task type, and use that field to retrieve the task type of a task instead the SPBuiltInFieldId.TaskType field that is cleared....

What do you think?

 

 

Coordinator
Aug 19, 2010 at 5:10 PM
Hi Javier,

I have been looking into your issue and there are a few observations noted below that I disagree with. As you may know WSS 3 Workflow Tools ships with a sample workflow. In this sample we make use of the TaskType to differentiate between two tasks. Both tasks are completed using a CompleteTask activity. I can see that SharePoint does not modify the TaskType parameter after completing the task. For the sample workflow, after completing both tasks, both tasks still open with the correct user control. I have also used the SharePoint OM to open the task list and I have verified that the ows_TaskType field still contains the values 0 and 1 for our two sample tasks.
On the issue of task completion and doing something special. Our tools do nothing to facilitate this. You can use the LoadData method do access the task and check the Completed field. If it is true, you could for instance disable all editing controls, or do a redirect. All of this is up to you however, we provide no guidance in this since everyone wants some other behavior.

Hope it helps,

Wouter

________________________________

Van: javieruy [mailto:notifications@codeplex.com]
Verzonden: do 19-8-2010 14:28
Aan: Wouter van Vugt
Onderwerp: Re: Problem in editing a completed task [wss3workflow:222737]



From: javieruy

Hi, i have been debugging your application and I realized what is the problem....

Fist an updat to the problem, when a i have more than one task in my workflow and someone wants to edit a completed task, it opens the user control associated with the first task, the one with TaskType 0.

Here is the source of the problem, on the TaskFormHost.cs class



protected void PlaceHolder_CreatingControl(object sender, EventArgs e)
{
WorkflowControlPlaceHolder placeHolder = sender as WorkflowControlPlaceHolder;
int taskType = (int)base.ListItem[SPBuiltInFieldId.TaskType]; //When the task is completed it always return false.
placeHolder.PlaceHolderType = taskType.ToString(CultureInfo.InvariantCulture);
}

The problem is the line:

int taskType = (int)base.ListItem[SPBuiltInFieldId.TaskType];

When a task is completed this returns always 0, this is because sharepoint cleans all the properties of the task once it is completed.

The problem I have with this is i am sending mails wiht the url of tasks, if someone click on a url associated with a task that it is completed, it opens the user control of the first task and it is very confusing. I could redirect to error page, if the task is completed, but it would be nice if it opens the correct user control. One thing you can do is not using the field ListItem[SPBuiltInFieldId.TaskType]; create your own field on your content type to store the correct task type, and use that field to retrieve the task type of a task instead the SPBuiltInFieldId.TaskType field that is cleared....

What do you think?





Read the full discussion online <http://wss3workflow.codeplex.com/Thread/View.aspx?ThreadId=222737&ANCHOR#Post482286> .

To add a post to this discussion, reply to this email ([email removed] <mailto:[email removed]?subject=[wss3workflow:222737]> )

To start a new discussion for this project, email [email removed]

You are receiving this email because you subscribed to this discussion on CodePlex. You can unsubscribe or change your settings <https://wss3workflow.codeplex.com/subscriptions/thread/project/edit> on codePlex.com.

Please note: Images and attachments will be removed from emails. Any posts to this discussion will also be available online at codeplex.com