Sharepoint Forum

Ask Question   UnAnswered
Home » Forum » Sharepoint       RSS Feeds

SP Designer workflow is failing when ItemUpdating event handler imp

  Asked By: Celia    Date: Jun 01    Category: Sharepoint    Views: 5244

I have created a SharePoint designer workflow, for a issue list when Item
created and Item Updated events occur. It is working fine.

I have created a event handler for same issue list, to stop deleting the list
item(ItemDeleting event) and stop updating list item(ItemUpdating event) when it
is in Completed state.

ItemDeleting event handling is working fine.

Problem Scenario 1:
ItemUpdating, when I am changing list item to Completed status, from any other
state(New, Assigned, UAT etc), the workflow, which I have written in SharePoint
designer is failed, displayed like Error Occurred and the list item is getting
updated successfully. When I see in workflow logs, it is saying Error updating a
list item

Problem Scenario 2:
When I try to modify any list item which is in Completed state, it showing a
big messages along with given message and Item is not getting modified. I am
keeping long message as an attachment to this mail.

Following is the code for ItemUpdating:

public override void ItemUpdating(SPItemEventProperties properties)
SPListItem request = properties.ListItem;
string requeststatus = request["Request Status"].ToString();
if (requeststatus == "Completed")
properties.ErrorMessage = "Selected request is in Completed status,
cannot edit: " + requeststatus;
properties.Cancel = true;

can anybody has an idea, how to resolve this.



No Answers Found. Be the First, To Post Answer.