SharePoint - Sharepoint Workflow - Asked By Anand Malli on 23-Jun-10 05:22 AM

Hi everyone,

I've requirement in which i've created sequential workflow. In workflow, the taks is assigned to the sharepoint groups(i.e.Checker) sucessfully. the users of the checker group is getting an email about the task.

Now suppose one of user from group(i.e.Checker) is open the task form and update the task. so at this level, task is sucessfully completed.

Now there is another user belongs to same group(i.e.Checker) also going to open form(i.e.task form) from an email. but here i want to prevent those user to update the task. Because task is already complete.

So how can i prevent users belongs to same group from updating task which is already completed ?

Please provide solution!!!

Alon Havivi replied to Anand Malli on 23-Jun-10 03:08 PM
Hello Anand,

You can create a list item Event Handler (see: http://msdn.microsoft.com/en-us/library/ms437502.aspx).
In the ItemUpdating method you can check if the task is already completed.

Somthing like this:

public override void ItemUpdating(SPItemEventProperties properties)
{   
  SPListItem item = site.Lists[ListID].GetItemById(properties.ListItemId);
  string status = item["Status"].ToString();

  if (status.ToLower().IndexOf("Completed") > -1)
  {
      properties.Cancel = True
      properties.ErrorMessage = "The task has already completed"
  }
}
kundan kumar replied to Anand Malli on 11-Mar-11 07:17 AM
Hi,

Just try this solution.

Use a hidden field.
When first user will update the report then assign some value to that hidden control.
Next time when ever that report will go to any user, just check for the value of that hidden control.

If value is there then do not allow that user to update, else go ahead.

This is the solution you can try.....

Thanks,
Kundan Kumar