Tuesday, May 11, 2010

How to change SharePoint Workflow status to a custom value

Step 1 - Add following to workflow.xml file

<ExtendedStatusColumnValues>

<StatusColumnValue>Need Restart</StatusColumnValue>                

<StatusColumnValue>Waiting for Approval</StatusColumnValue>

</ExtendedStatusColumnValues>

Step 2 - Use SharePoint Workflow SetState shape.

Bind a field workflowState to its State Property.

MethodInvoking - setWorkflowStatus_MethodInvoking

private void setWorkflowStatus_MethodInvoking(object sender, EventArgs e)

{

//// SPWorkflowStatus.Max for "Need Restart"

//// SPWorkflowStatus.Max + 1 for "Waiting for Approval"

this.workflowState = (int)SPWorkflowStatus.Max;

}

Step 3 - For an existing feature, deactivate - uninstall - install - Activate the feature for the above changes to reflect.

No comments:

Post a Comment