Community Commons java action executeUnverifiedMicroflowInBackground cannot be used with a queue when using an expression

0
In mendix 9.1.0 I’m using the community commons function executeUnverifiedMicroflowInBackground to start a microflow that is provided in a string field. I want to perform this task via a task queue. When selecting the task queue I always get the error that ‘ A Java action used for background execution must have a return type of ‘Nothing’’ and cannot bypass this error. See below screenprint. I have tried to not use a return value (as seen in the screen print) but this doesn’t work. As this job is done via a queue I agree to no return value should be provided but the microflow that is triggered based on the expression is not returning a value. To my opinion this is incorrect error message and should the return value not be checked when an expression is used to determine the microflow name.    
asked
3 answers
0

As a quick fix, you could just clone the Java Action into your own module and modify the code to return nothing instead of a boolean. 

I know it’s not quite what you were asking, but it may help solve this problem in the short term.

UPDATE: example executeAction code

// BEGIN USER CODE
Misc.runMicroflowInBackground(getContext(), microflowName, contextObject);
return null;
// END USER CODE

You will also need to make sure Community Commons is still installed, and include the following import statement.
 

import communitycommons.Misc;

 

answered
0

Hi Robert,

I created a new java action with return value set to nothing. The error was gone but when building the app I get a compilation error (Boolean cannot be converted to Void).

 

Probably you had another solution in mind.. But thanks anyway, I have solved it by making two microflows...

Maybe I did something wrong.. Please advise

I’m not a Java expert so I try to avoid all kind of Java stuff 

answered
0

For anyone reading this now. The solutions here work, but are too difficult.

You might as well put the Java action in its own microflow and just execute that microflow in a queue. That works and takes about 10 seconds to develop.

answered