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>:

 <StatusColumnValue>Failed Verification</StatusColumnValue>

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;
        //Set workflow status to Failed Verification
        this.workflowState = (int)SPWorkflowStatus.Max + 1;

Comments (6)

  1. TJO says:

    What is type is this.workflowState ??

    Thank you.

  2. Ali Mazaheri says:

    workflowState is a local variable bound to SetState’s StateProperty

  3. the status cannot be updated again once the state property has been set – is this right?

    how do you programmatically set the status if you have more than just approved and rejected, such as pending, shipping, awaiting etc – i need to set several “states” throughout the process and I am stuck – once you set it, it appears you cannot set it again to a new status.

  4. Manoj says:

    Thanks a lot Ali!..

    I have been looking for this for around a month… finally i got it!! 🙂


  5. Vahag says:

    Hello and thanks.

    We have a problem whan try to use modification forms after setting the status of workflow to our custom status, and I thnik that is because realy workflow don`t no its real state. Is there any property or something like this, that can set for example workflow status to our custom status, but in real it will be "In progress".

  6. Where is your variable WorkflowState declared?

    Is it bound to some property?