At first Elements.xml file of workflow has to be changed and new custom states have to be added. Put this xml definition into <MetaData>.
<ExtendedStatusColumnValues>
<StatusColumnValue>Waiting for your approving</StatusColumnValue>
<StatusColumnValue>Approved and waiting</StatusColumnValue>
</ExtendedStatusColumnValues>
Then add a new setState activity to workflow and set methodInvoking. The method should look like this:
private void setStateApprovedAndWaiting_MethodInvoking(object sender, EventArgs e)
{
this.setStateToApprovedAndWaiting.State = (int)SPWorkflowStatus.Max + 1;
}
For better understanding read this articles:
http://msdn.microsoft.com/en-us/library/cc514224(office.12).aspx#MOSS2007DevWorkflowSolutions_SettingOutcomeValues
http://msdn.microsoft.com/en-us/library/microsoft.sharepoint.workflow.spworkflowstatus.aspx
That all look very nice and simple. Sadly for me my experience wasn't that much simple. If I wanted to use member of SPWorkflowStatus to set workflow status I got this error message: Specified argument was out of the range of valid values.Till know I don't know why. I also had some complex workflow and when I tried to set state to some of my custom states using function above the error occurred. When I set state directly in setState activity the custom state was set. So I would recommend to check and find ID of custom state and then use this number instead of setting state property in the function.
Maybe somebody also had the same problem and solve it, if so please don't hesitate to comment :)
Happy codding....
No comments:
Post a Comment