locked
How to access a parent activity from a child one RRS feed

  • Question

  • Hi All,

    I have a flowchart activity containing child activities. Inside child activities I need to get the parent activity's Id to store it as a reference. How can I access it?

    I see two ways.

    1. Somehow to access parent activity from a child one. This was pretty easy in older versions using Parent property but not anymore. Is there a way to access the parent activity?

    2. To provide parent activity's Id as an input parameter for a child one. But how can I refer to the current activity in a designer expression?

     

    Thanks for any hint.

    Artem Kliatchkine

    Wednesday, January 18, 2012 12:50 PM

Answers

  • @Artem, What do you want to do with the Parent ID once you got it? Parent activity ID is of limited use in WF4. Tim

    Basically, I found the solution for the initial problem. I needed not parent activity Id but workflow Id and this I can get from execution context of any activity.

     

    But one question stays, even if for curiosity only. Let's say I defined a variable in the workflow designer in the scope of a composite activity. Then I can easily assign an input parameter of any child activity to this variable directly in the designer. I even get intellisense support which gives me a hint. Can I do the same not with a variable but with a property of my composite activity? Something like this.[Property]?

    Monday, January 23, 2012 8:36 AM

All replies

  • Hi Artem,

     

    You can define a variblae at parent level or at the root level to hold the value of your ID , which yuo can access in any child activity. 

     

    Thanks,

    Madhur


    MB
    Friday, January 20, 2012 7:14 AM
  • Yes, this was the question 2. In the designer I need to assign a variable to a property of the current composite activity. Let's say the property is called Id. What should I type in designer expression to get it?
    Friday, January 20, 2012 9:00 AM
  • Define a varible at root Level (worflow level) and initialse this varibale in your parant activity and access that in the activity you want.

    Is it clear ?

     

    Thanks,

    Madhur


    MB
    Friday, January 20, 2012 9:03 AM
  • 1. I defined a variable.

    2. I want to assign it in designer. I can easily assign it to activity's argument, this is no pb. But I want to assign it to the property value of the activity. I couldn't find a way to refer to the current activity as an object in the expression you enter in designer when you assign a variable. Is there a way?

    Friday, January 20, 2012 9:09 AM
  • @Artem, What do you want to do with the Parent ID once you got it? Parent activity ID is of limited use in WF4. Tim
    Friday, January 20, 2012 6:34 PM
  • @Artem, What do you want to do with the Parent ID once you got it? Parent activity ID is of limited use in WF4. Tim

    Basically, I found the solution for the initial problem. I needed not parent activity Id but workflow Id and this I can get from execution context of any activity.

     

    But one question stays, even if for curiosity only. Let's say I defined a variable in the workflow designer in the scope of a composite activity. Then I can easily assign an input parameter of any child activity to this variable directly in the designer. I even get intellisense support which gives me a hint. Can I do the same not with a variable but with a property of my composite activity? Something like this.[Property]?

    Monday, January 23, 2012 8:36 AM
  • Let's say I defined a variable in the workflow designer in the scope of a composite activity. Then I can easily assign an input parameter of any child activity to this variable directly in the designer. I even get intellisense support which gives me a hint. Can I do the same not with a variable but with a property of my composite activity? Something like this.[Property]?
    No, property access via VB expressions is not supported.
    Tim
    Tuesday, January 24, 2012 10:50 PM