Can TargetStateName of SetState Activity be dynamically modified?

Is it possible to modified the targetstatename of a SetState Activity after the workflow instance have been invoked


Answer this question

Can TargetStateName of SetState Activity be dynamically modified?

  • Tutnik

    Further to that I would add,

    If you want to do this functionality, the easiest way to do it is from a code
    activity - use the SetState method there.

    Alternatively you could add the SetState shape dynamically at run time.
    (see lab11 in the WWF Hands on labs)

    I ran into the same brick wall earlier on in the piece.



  • CoolCoolMan

    No. Targetstate has to be set at designtime and cannot be changed after invoking the workflow instance.

    - Vihang



  • Kode Hunt

    Hi Mick,

    I publish my workflow as webservice. I add a CodeActivity between WebInputActivity and WebOutputActivity, and make the execute code as following:

    WorkflowRuntime runtime = WorkflowWebRequestContext.Current.WorkflowRuntime;
    StateMachineWorkflowInstance instance = new StateMachineWorkflowInstance(runtime, this.WorkflowInstanceId);
    instance.SetState(newStateName);

    But the application say error: 'Instance operation is not valid on workflow runtime thread'.

    How can I handle it

    Regrards,
    ZhuangYicheng

  • Can TargetStateName of SetState Activity be dynamically modified?