Link between designer and activity, activity management RRS feed

  • General discussion

  • Hi,

    I just starting to work with a workflow and I have two questions.

    Firstly, is there any way to access workflow designer (its public properties) from a custom activity, or make some link during design? Passing data from designer should do the work as well.

    Secondly, since there is no System.Activities.Parent (WF4.0) is there any other way (effective) to know a parent, I am not interested in the root. I am particularly interested to use it in overrode  method 

    protected override void CacheMetadata(NativeActivityMetadata metadata) { ... }


    Thanks for responses.

    • Changed type Andrew_Zhu Thursday, September 1, 2011 2:07 AM no reply
    Thursday, August 25, 2011 9:58 AM

All replies

  • Hi bodzon,
    For the first question, do you actually want to access the WorkflowDesigner from a custom activity, or from a custom activity designer? What are you trying to do?

    For the second question, I'm not sure if you can get the root at CacheMetadata time. Why do you need the parent, do you actually just need particular information from it?
    Saturday, August 27, 2011 5:58 AM
  • Well, thank you for your interest.

    I want to access data stored in workflow designer class by custom activities - something like global data for all activities.

    Secondly, I would like to get to the parent to determine whether parent is particular activity. In other words if customActivity_A is in customActivity_B perform some action (for example, get parent's property), else do nothing.


    Also I managed to pass data from rehosted workflow designer to main sequence as InArgument, and then access it from other custom activities.

    • Edited by bodzon Friday, September 2, 2011 1:50 PM
    Friday, September 2, 2011 1:31 PM
  • I think overall I'm still not quite clear what you're doing. Like whether you're talking about sharing data during the time of designing the workflow, or running it? If runtime, how does the designer come in, are you saying

    a) design the workflow, at this time set up some 'global' variable which all activities can access
    b) runtime - feed in the actual value to the variable, the activities finally get to consume the value?

    I think the standard way of doing this is to use InArguments to the Workflow.

    For the second question, does the action need to be at CacheMetadata time, or at runtime? I'm thinking if it's at runtime you can instead base it off of other mechanisms, like a Property or Argument value. If you really want to be more esoteric, and avoid regular properties and arguments, and do it based on the composition, there are some ways, like Execution Properties... but that may be overcomplicated.

    Sunday, September 4, 2011 3:02 AM
  • I’ll try to explain it clearer.

    I’m rehosting Workflow designer. User can choose one of his workflows. Each workflow is stored and has unique ID.  Assume that only rehosted designer has access to this ID. How can I access from custom activity (during design) to this ID (stored in rehosted designer).


    Sunday, September 4, 2011 6:08 PM
  • If you're running with WorkflowInvoker/WorkflowApplication, you could make an ID provider Extension to pass into the workflow as it's being executed. Every activity in the entire workflow can then access the ID via the Extensions property in ActivityExecutionContext.

    Tuesday, September 6, 2011 4:26 AM