How to throw an error from a microflow to be caught by standard Mendix error handling
When within a microflow a situation is detected which should not occur (like a comparison expression which returns false because an attribute does not match a certain value), I like to throw an error from this microflow to the calling microflow, so that higher level microflow can handle the error using the normal Mendix error handling. I thought the 'error event' was the way to go, but this does not work since (as the documentation states) : An error event defines a location where the microflow will stop and throw an error that occurred earlier. How should I throw an error from my microflow ?
Check out the CommunityCommons Java action "ThrowException"
You can of course return a boolean value from the sub-microflow and use a split in the calling microflow based on the returned value. Set the return type to boolean in your sub-microflow and use your comparison expression to set the return value.