cancel
Showing results for 
Search instead for 
Did you mean: 

CallActivity - get the parent name

stroobat
Champ in-the-making
Champ in-the-making
Is it possible to get the name of the parent when using CallActivity ?

For instance:

I have a workflow called parentWorkflow which calls a subworkflow using callActivity.
In this subworkflow I have a service task where I want to get the name of the callActivity task that triggered the subworkflow.

My servicetask in the subworkflow looks likes this:


   public void yetAnotherServiceMethod(ExecutionEntity execution)
   {
      String parameter = (String)execution.getVariable("outputparameter");

   }

Through the ExecutionEntity I can get the ID of the CallActiviti task but not the name.
I have a workaround for it, but don't prefer to use it …


   public void yetAnotherServiceMethod(ExecutionEntity execution)
   {
      String parameter = (String)execution.getVariable("outputparameter");
      Map map = new HashMap();
      map = (Map)execution.getSuperExecution().getActivity().getProperties();
      String name = (String)map.get("name");
      System.out.println("Calling service task: " + name);
   }

It would be nicer if I could do something like this:

   String name = execution.getSuperExecution().getActivityName();

The following method does exist:

   String myId = execution.getSuperExecution().getActivityId();
1 REPLY 1

frederikherema1
Star Contributor
Star Contributor
Since the name of the activity is more of a "design/modeling" thing, only the ID is exposed (this one uniquely identifies the activity) and IMHO, I don't really see any benefit, (other than display/debugging purposes) of adding such a method.

You could alternatively, use the ReadOnlyProcessDefinition to get the activity name from, based on the activity id…