How can I get the return value of a class in another class

7
I have the following case: I created one JAVA action that has a String as input parameter and a enumeration as return value. I am using this in a microflow and that works great. Now I would like to use it in a situation without microflow, but only with JAVA code. So, in one JAVA action I would like to call the other JAVA action and use it's return value. How can I do this?
asked
2 answers
5

You can call a JAVA action from another JAVA action (in the execute method) as follows:

HashMap<String, Object> params = new HashMap<String, Object>(); 
Core.execute(this.getContext(), "Module.JavaActionName", params);

Where params is a HashMap with parameters that the JAVA action you call expect.

The other way is that you create a instance of the 'second' JAVA action class and call the execute function on the created object. But that's not advised because you pass the Core functionality of the Core.execute function.

I hope this helps you. If not, clarify your question.

answered
2

If you run a java action in a microflow, the return value will be placed in variable. This variable can be used as parameter for the other java action call.

answered