Community Commons java action executeUnverifiedMicroflowInBackground cannot be used with a queue when using an expression
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.
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);
// END USER CODE
You will also need to make sure Community Commons is still installed, and include the following import statement.
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