I am working on State Machine Workflow using Visual Studio 2010 Workflow.
I want to update the list item on item changed. But unable to update the item. I am updating the item in nested If-Else condition. I am using Declarative Rule Condition.
Please Refer the code below and Workflow Image:
private void onManagerTaskChanged_Invoked(object sender, ExternalDataEventArgs e)
{
try
{
if (onManagerTaskChanged_AfterProperties1.ExtendedProperties[workflowProperties.TaskList.Fields["Status"].Id].ToString().Trim().ToUpper() == "SENT FOR CORRECTION")
{
}
else if (onManagerTaskChanged.AfterProperties.ExtendedProperties[workflowProperties.TaskList.Fields["Status"].Id].ToString().Trim().ToUpper() == "APPROVED")
{
if (workflowProperties.Item["Planning Status"].ToString().Trim().ToUpper() == "IN PROGRESS" || workflowProperties.Item["Mid Review Status"].ToString().Trim().ToUpper() == "COMPLETED" && workflowProperties.Item["Final Status"].ToString().Trim().ToUpper() == "IN PROGRESS")
{
//WriteLog("Condition is true.");
workflowProperties.Item["Planning Status"] = "Approved";
workflowProperties.Item.SystemUpdate();
}
else if (workflowProperties.Item["Mid Review Status"].ToString().Trim().ToUpper() == "IN PROGRESS")
{
workflowProperties.Item["Mid Review Status"] = "Completed";
workflowProperties.Item.SystemUpdate();
}
}
else
{
}
}
catch (Exception ex)
{
WriteLog(ex.ToString());
}
}
I am unable to update the list item in Second if-else. I can update the list item in First if-Else or outside of Second if-Else.
In short I want to update "Approved" in Planning Status column but cant update.
Please help. Its very urgent.
- Khan Abubakar