Skip to main content
10-Marble
October 14, 2025
Solved

Obtain expression robot name from called java class

  • October 14, 2025
  • 2 replies
  • 460 views

All,

 

I have a scenario where I am calling a custom java method from an expression robot in a workflow. I pass the self and primaryBusinessObject references as parameters to the call and what I need is to get the name of the expression robot. This is not a problem when the call is made from an assigned activity because then the self variable refers to the activity from which I can get the name. However, when self is send from an expression robot it refers to the process itself. 

 

Does anybody know how to get the name of the expression robot? I should mentions that in this particular scenario I do not want to pass it as a parameter to the method.

Best answer by RandyJones

@dsodling wrote:

All,

 

Does anybody know how to get the name of the expression robot? I should mentions that in this particular scenario I do not want to pass it as a parameter to the method.


One way to do this is to add a Workflow String variable eg robotName then in the robot do this:

robotName = "Name of this robot";

new com.xyz.CustomClass(self, primaryBusinessObject);

 

This robotName variable can then be extracted in the custom class:

CustomClass(ObjectReference self, Object primaryBusinessObject) {
 WfProcess wfProcess = self.getObject();
 ProcessData processData = wfProcess.getContext();
 String robotName = null;
 Object wfVariable = processData.getValue("robotName");
 if ((wfVariable != null) && wfVariable instanceof String) {
 robotName= (String) wfVariable;
 }
 // you now have the robotName to do with as needed
}

 

2 replies

6-Contributor
October 16, 2025

Hi @dsodling ,

I havent had the time to go digging around how exactly it works but I have noticed that by using the "Externalize Expressions" action, the generated java class file created method names that correspond to the wf robots (including expressions).

What I can see is that the ids created match what is in the WF Template XML when exported, but those ids tend to change frequently; basically, on every export.

 

I assume then that if you can peak into this process there will be some hint as to how that is achieved. see also Externalizing Expressions for a Workflow Template

 

Sorry it's not a direct solution but maybe this is helpful,

/Felix

 

FYI:
Im getting method names like:

for expression robots

wfExprRobotTemplate_230529__ROBOT_EXPRESSION_

for wfactivities in the Start transition specifically in this case

wfAssignedActivityTemplate_230514_START

for conditionals:

wfConnectorTemplate_230552__ROUTER_EXPRESSION_
dsodling10-MarbleAuthor
10-Marble
October 17, 2025

Thank for the hint!

As you say, it is not a complete solution but I will for sure look into it.

Thanks again!

20-Turquoise
October 16, 2025

@dsodling wrote:

All,

 

Does anybody know how to get the name of the expression robot? I should mentions that in this particular scenario I do not want to pass it as a parameter to the method.


One way to do this is to add a Workflow String variable eg robotName then in the robot do this:

robotName = "Name of this robot";

new com.xyz.CustomClass(self, primaryBusinessObject);

 

This robotName variable can then be extracted in the custom class:

CustomClass(ObjectReference self, Object primaryBusinessObject) {
 WfProcess wfProcess = self.getObject();
 ProcessData processData = wfProcess.getContext();
 String robotName = null;
 Object wfVariable = processData.getValue("robotName");
 if ((wfVariable != null) && wfVariable instanceof String) {
 robotName= (String) wfVariable;
 }
 // you now have the robotName to do with as needed
}

 

dsodling10-MarbleAuthor
10-Marble
October 17, 2025

I kind of feel a bit dumb now for not thinking about that 😊

Thanks!