i:0#.w|Ali.Mazaheri

SharePoint, Office 365 and Azure!

Setting Workflow Status to custom value

Setting Workflow Status to custom value

  • Comments 6

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;
}

  • What is type is this.workflowState ??

    Thank you.

  • workflowState is a local variable bound to SetState's StateProperty

  • 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.

  • Thanks a lot Ali!..

    I have been looking for this for around a month... finally i got it!! :)

    Great!

  • 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".

  • Where is your variable WorkflowState declared?

    Is it bound to some property?

    Thanks

Page 1 of 1 (6 items)
Leave a Comment
  • Please add 7 and 6 and type the answer here:
  • Post