Problem
When a microflow uses a single RETURN at the end with a result variable (instead of multiple RETURN statements in each branch), mxcli still generates nested IF/ELSE decision diamonds. This produces a microflow layout in Studio Pro with many crossing/diverging sequence flows that is hard to read.
Example
CREATE OR REPLACE MICROFLOW OrderManagement.ChatContext_ActionMicroflow (
$ChatContext: ConversationalUI.ChatContext
)
RETURNS Boolean AS $Success
FOLDER 'Chat'
BEGIN
DECLARE $Success Boolean = false;
$Request = CALL MICROFLOW ConversationalUI.ChatContext_Preprocessing("ChatContext" = $ChatContext);
IF $Request != empty THEN
RETRIEVE $Agent FROM AgentCommons.Agent
WHERE Title = 'SupplyChainOrderAgent'
LIMIT 1;
IF $Agent != empty THEN
$Response = CALL JAVA ACTION AgentCommons.Agent_Call_WithHistory(...);
IF $Response/GenAICommons.Response_Message != empty THEN
$Message = CALL MICROFLOW ConversationalUI.ChatContext_UpdateAssistantResponse(...);
SET $Success = true;
END IF;
ELSE
LOG ERROR NODE 'OrderManagement' 'SupplyChainOrderAgent not found';
END IF;
END IF;
RETURN $Success;
END;
This MDL is logically clean — one entry, one exit, a single RETURN $Success at the end. But the generated microflow in Studio Pro has 3 nested decision diamonds with sequence flows that zigzag across the canvas, making it visually cluttered.
Expected behavior
Nested IF blocks that converge to a single exit point should produce a clean layout where the "false" branches merge back into the main flow without excessive crossings. Ideally the layout engine would:
- Keep the happy path on the main horizontal/vertical axis
- Route false/empty branches as short side-paths that rejoin the main flow
- Minimize sequence flow crossings
Screenshot
(To be added manually)
Environment
- mxcli: 0.1.0
- Mendix: 11.6.4
Copied from engalar#47
Comments from original issue
@engalar (2026-04-08T01:59:23Z):

Problem
When a microflow uses a single
RETURNat the end with a result variable (instead of multipleRETURNstatements in each branch), mxcli still generates nested IF/ELSE decision diamonds. This produces a microflow layout in Studio Pro with many crossing/diverging sequence flows that is hard to read.Example
This MDL is logically clean — one entry, one exit, a single
RETURN $Successat the end. But the generated microflow in Studio Pro has 3 nested decision diamonds with sequence flows that zigzag across the canvas, making it visually cluttered.Expected behavior
Nested IF blocks that converge to a single exit point should produce a clean layout where the "false" branches merge back into the main flow without excessive crossings. Ideally the layout engine would:
Screenshot
(To be added manually)
Environment
Copied from engalar#47
Comments from original issue
@engalar (2026-04-08T01:59:23Z):
