Skip to content

Commit 154045f

Browse files
akoclaude
andcommitted
fix #590: rewrite Level 9.1 call-external-action to use TripPin schema
The original Level 9.1 created a microflow `OdTest.ACT_CallExternalAction` that called `OdTest.SalesforceAPI.GetAccounts(...)` and `OdTest.SalesforceAPI.NotifyUpdate(...)`. SalesforceAPI's MetadataUrl is a placeholder that doesn't return $metadata, so the ConsumedODataService BSON is written with an empty `Metadata` cache. Studio Pro's project checker then resolves the Name fields against an empty schema, gets null, and the checker aborts with a NullReferenceException in `Mendix.Modeler.Integration.CallExternalAction.get_SchemaAction()` → `ExternalActionParameterMapping.get_SchemaParameter()`. The crash blocks all in-IDE error reporting, not just for this microflow. Move the microflow definition to a new Level 10.4.1, right after the TripPin client is created (Level 10.1) and its $metadata is actually cached. Use unbound TripPin entries `GetNearestAirport` (Function with lat/lon parameters and a Trippin.Airport return) and `ResetDataSource` (parameterless Action) so both the parameter-mapping and the `on error continue` variants are still demonstrated. The microflow stays in `OdTest` so `show external actions in OdTest` (Level 9.2) still returns a row. The existing drop in Level 8.8a already runs before Level 8.8c (TripPin client drop), so cleanup order is correct. Issue #590 separately documents the upstream Studio Pro robustness gap (`SchemaAction` should null-check instead of NREing) so it can be escalated to Mendix support. Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
1 parent 4f0293f commit 154045f

1 file changed

Lines changed: 29 additions & 13 deletions

File tree

mdl-examples/doctype-tests/10-odata-examples.mdl

Lines changed: 29 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -378,16 +378,15 @@ revoke access on odata service OdTest.CustomerAPI from OdTest.user;
378378
-- LEVEL 9: EXTERNAL ACTION CALLS IN MICROFLOWS
379379
-- ############################################################################
380380

381-
/**
382-
* Level 9.1: Call an external action with parameters and result variable
383-
*/
384-
create microflow OdTest.ACT_CallExternalAction() returns boolean
385-
begin
386-
$Result = call external action OdTest.SalesforceAPI.GetAccounts(status = 'active', Region = $SelectedRegion);
387-
call external action OdTest.SalesforceAPI.NotifyUpdate(AccountId = $AccountId) on error continue;
388-
return true;
389-
end;
390-
/
381+
-- Level 9.1: Call an external action — see Level 10.4.1 below.
382+
--
383+
-- The microflow is created after Level 10.1 because Studio Pro resolves
384+
-- `call external action` Name fields against the cached $metadata schema of
385+
-- the ConsumedODataService. SalesforceAPI's MetadataUrl is a placeholder
386+
-- that doesn't actually return $metadata, so its cache is empty and any
387+
-- action call against it would crash Studio Pro's project checker with a
388+
-- NullReferenceException in CallExternalAction.SchemaAction (see mxcli#590).
389+
-- TripPin has reachable metadata, so its actions resolve correctly.
391390

392391
/**
393392
* Level 9.2: Show external actions discovered from microflow usage
@@ -462,14 +461,31 @@ create or modify external entities from TripPinClient."TripPinApiClient"
462461
into TripPinClient;
463462
/
464463

464+
/**
465+
* Level 10.4.1: Demonstrate `call external action` against TripPin schema
466+
* actions. Both ResetDataSource (no parameters) and GetNearestAirport
467+
* (parameterised with a return variable) are unbound entries in TripPin's
468+
* cached $metadata, so Studio Pro's project checker resolves SchemaAction
469+
* correctly. The microflow lives in OdTest to keep `show external actions
470+
* in OdTest` (Level 9.2) returning a row, but references the TripPin client.
471+
*/
472+
create microflow OdTest.ACT_CallExternalAction() returns boolean
473+
begin
474+
$Airport = call external action TripPinClient."TripPinApiClient".GetNearestAirport(lat = 47.6062, lon = -122.3321);
475+
call external action TripPinClient."TripPinApiClient".ResetDataSource() on error continue;
476+
return true;
477+
end;
478+
/
479+
465480
-- ############################################################################
466481
-- LEVEL 8.8: DROP (cleanup)
467482
-- ############################################################################
468483

469484
/**
470-
* Level 8.8a: Drop objects that reference SalesforceAPI before dropping the client.
471-
* OdTest.ACT_CallExternalAction calls SalesforceAPI actions; OdTest.RemoteAccount
472-
* is an external entity backed by SalesforceAPI — both must be removed first.
485+
* Level 8.8a: Drop objects that reference OData clients before dropping the
486+
* clients themselves. OdTest.ACT_CallExternalAction (created in Level 10.4.1)
487+
* calls TripPin actions, and OdTest.RemoteAccount is an external entity
488+
* backed by SalesforceAPI — both must be removed first.
473489
*/
474490
drop microflow OdTest.ACT_CallExternalAction;
475491
/

0 commit comments

Comments
 (0)