Welcome to MSDN Blogs Sign in | Join | Help

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

Published Friday, February 08, 2008 5:37 AM by AMazaheri

Comment Notification

If you would like to receive an email when updates are made to this post, please register here

Subscribe to this post's comments using RSS

Comments

# re: Setting Workflow Status to custom value

What is type is this.workflowState ??

Thank you.

Wednesday, February 20, 2008 12:41 PM by TJO

# re: Setting Workflow Status to custom value

workflowState is a local variable bound to SetState's StateProperty

Friday, February 22, 2008 12:01 AM by AMazaheri

# re: Setting Workflow Status to custom value

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.

Friday, August 01, 2008 6:10 PM by alex talarico

# re: Setting Workflow Status to custom value

Thanks a lot Ali!..

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

Great!

Monday, December 29, 2008 7:40 AM by Manoj

# re: Setting Workflow Status to custom value

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

Tuesday, February 17, 2009 3:01 AM by Vahag

# re: Setting Workflow Status to custom value

Where is your variable WorkflowState declared?

Is it bound to some property?

Thanks

Tuesday, June 16, 2009 7:51 AM by Zarko Radevic

Leave a Comment

(required) 
required 
(required) 

  
Enter Code Here: Required
 
Page view tracker