locked
Dynamically seting state in statemachine workflow RRS feed

  • Question

  • Also is there any way to set a state dynamically ? I tried SetState ss = new SetState("StateName")

    ss.TargetState = "ExistingStateName" but it doesnot work.

    Thursday, March 30, 2006 3:58 PM

Answers

  • Hi,

      You can use the SetState method on the StateMachineWorkflowInstance class in order to set the state of the workflow from the host. There is no way to set the state dynamically from inside the workflow. You can create the StateMachineWorkflowInstance class by passing in the instance ID of the workflowinstance that represents the state machine.

    Thanks

    Pravin Indurkar

     

    Thursday, March 30, 2006 6:05 PM

All replies

  • Hi,

      You can use the SetState method on the StateMachineWorkflowInstance class in order to set the state of the workflow from the host. There is no way to set the state dynamically from inside the workflow. You can create the StateMachineWorkflowInstance class by passing in the instance ID of the workflowinstance that represents the state machine.

    Thanks

    Pravin Indurkar

     

    Thursday, March 30, 2006 6:05 PM
  • Isn't there a way I can change a state of a workflow programmatically? I would assume so, becuase using the SetStateActivity isn't anything else.

    I would like to change the state of a state machine workflow from StateA to StateB within the code of the Workflow.

    Is this possible? Which other possibilities are there? 

    Thank you

    ----------------------

    EDIT:

    I once again posted to early. There is a way.

    I use a variable which holds the status of a certain variable. I set this state in my code activity, and then use a If Activity with a SetStateActivity. So I dont have to change the state of the workflow programmatically.

    Monday, May 22, 2006 12:46 PM