Repository navigation
Description
Environment: mxcli v0.30.0-47-g6094f471f (built from 6094f471f, the current main), Mendix 11.16.1 project (MPR v2), macOS. The app consumes an OData v4 service with updatable external entities.
Summary: There is no MDL statement for the Send external object (Microflows$SendExternalObject) and Delete external object (Microflows$DeleteExternalObject) activities. This has two effects:
- A microflow that writes an external entity cannot be authored in MDL at all. Studio Pro refuses a plain
commiton an external entity ("…because it is an external entity. Use the 'Send external object' activity instead"), so there is no MDL way to save one. - The drop-and-create rebuild, which the
MDL-V1-REBUILDrefusal recommends, deletes an existing send activity silently.checkpasses,execprints no warning, and the activity is gone.
Steps to reproduce:
A stored microflow that changes an external object and sends it:
$ mxcli -p InventoryAdmin.mpr -c "describe microflow Main.ACT_District_DeleteClose"
...
begin
@start(-2146, 57)
$MxSystemUser = call microflow InventoryApi.GetMxSystemUserForDistrict(District = $District);
change $District (Active = false);
-- Unsupported action: Microflows$SendExternalObject
call microflow Main.ASUB_District_Delete(DistrictId = $District/IntDistrictID) in queue Main.TQ_ResourceCleanup;
close page 2147483647;
show page Main.District_Overview;
return;
end;
- Save that output to
rt.mdl, add one statement after thechange, and strip the@position/@start/@curve/@anchorlines.create or modifysplices the new statement in and keeps the send. This path is fine. - With the positions kept,
create or modifyis refused (MDL-V1-REBUILD). The message says: "to rebuild the flow deliberately, drop the microflow and create it in the same script". - Do exactly that:
drop microflow Main.ACT_District_DeleteClose;followed by the samecreate or modify microflow …from step 1.
$ mxcli check rt4.mdl -p InventoryAdmin.mpr --references
...
Check passed!
$ mxcli exec rt4.mdl -p InventoryAdmin.mpr
Dropped microflow: Main.ACT_District_DeleteClose
Removed its execute grants to Main.User. ...
Created microflow: Main.ACT_District_DeleteClose
$ mxcli -p InventoryAdmin.mpr -c "describe microflow Main.ACT_District_DeleteClose" | grep -c SendExternalObject
0
Expected behavior:
send external object $Var [refresh in client];anddelete external object $Var [refresh in client];exist, with the usualon error …handling. Both round-trip throughdescribe.- Until they exist,
check/execrefuse a script that recreates a flow whose stored version holds anUnsupportedAction. A-- Unsupported action:line in the source of a create should be an error, not a comment that is dropped.
Actual behavior: The activity is described as a comment. Every path that rebuilds the flow from that text writes it without the activity, and reports success. The changed attribute values are then never sent to the service. Nothing fails at build time, because a microflow with no send is valid. The data is simply not saved.
Root cause:
- The reader has no case for either type.
actionFromGenreturns nil, somdl/backend/modelsdk/microflow.go:663storesµflows.UnsupportedAction{StorageType: …}. sdk/microflows/microflows_actions.go:1571documents thatUnsupportedActionis deliberately inert on the write side: "microflowActionToGenhas no case for it, so an UnsupportedAction never reaches BSON".- The formatter prints it as a comment (
mdl/executor/cmd_microflows_format_action.go:368), and a comment parses to nothing. - The splice path keeps the stored activity because it does not rewrite it. The drop+create path has no stored activity to keep.
- The generated types already exist:
modelsdk/gen/microflows/types.go:10412(SendExternalObject:errorHandlingType,variableNameToBeSent,refreshInClient) and:3013(DeleteExternalObject:errorHandlingType,deleteVariableName,refreshInClient). So the missing parts are the grammar, AST, builder, reader, writer and formatter, which is the same set Feature: MDL support for the built-in Send Email microflow activity (Studio Pro 11.13+ beta, Microflows$SendEmailAction) #1315 added for Send Email.
Suggested fix:
- Add the two statements end to end, with a round-trip test (
exec→describe→execgives no change). A reader-only test cannot catch a missing writer case (seedownload fileis parsed and built but never written: activity lands in the .mpr with no action (CE0008) #850). - Separately, and smaller: when a script drops a flow and creates it again, compare the stored flow's
UnsupportedActions with the new body. Refuse if any would be lost, and name them. DESCRIBE NANOFLOW renders SynchronizeAction as-- Empty action, and the fallback co mment silently drops the activity's entire error handler #863 made the activity visible indescribe. This would make losing it loud as well.
Workaround used: write everything else in MDL, then add the send activity through Studio Pro (by hand or through its MCP ped_update_document).
Activity
feat(microflows): send external object and delete external object (#1939
Merge pull request mendixlabs#1735 from ako/claude/serene-hopper-zxbr4u