i:0#.w|Ali.Mazaheri

Azure, Open Source, SharePoint and ...

Setting Workflow Status to custom value

To set the Workflow status to a custom value add your custom Status values to workflow.xml under <MetaData>:


<ExtendedStatusColumnValues>
 <StatusColumnValue>Rejected</StatusColumnValue>
 <StatusColumnValue>Failed Verification</StatusColumnValue>
</ExtendedStatusColumnValues>

Using SetState activity and SPWorkflowStatus you can set the status programmatically as follows:



private void setState_MethodInvoking(object sender, EventArgs e)
{


    if (!this.changeApproved)
    {
        //Set workflow status to Rejected
        this.workflowState = (int)SPWorkflowStatus.Max;
    }
    else
        //Set workflow status to Failed Verification
        this.workflowState = (int)SPWorkflowStatus.Max + 1;
}