Skip to content

feat: MDL support for workflow microflow actions (GetWorkflowDataAction, WorkflowCallAction, etc.) #156

@engalar

Description

@engalar

Problem

When a microflow in Studio Pro uses workflow built-in activities, mxcli cannot represent them in MDL. The cmd_microflows_format_action.go formatAction switch has no case for any of the following action types (which exist in generated/metamodel/types.go):

Mendix SDK Type Studio Pro Activity Use case
Microflows$GetWorkflowDataAction Get workflow data From System.Workflow → typed context entity
Microflows$GetWorkflowsAction Get workflows From context object → list of System.Workflow
Microflows$GetWorkflowActivityRecordsAction Get workflow activity records Audit/history
Microflows$WorkflowCallAction Call workflow Start a workflow from a microflow
Microflows$WorkflowOperationAction Workflow operation Abort/restart/jump
Microflows$OpenUserTaskAction Open user task page Navigation
Microflows$SetTaskOutcomeAction Set task outcome Programmatic completion
Microflows$LockWorkflowAction Lock workflow Admin
Microflows$UnlockWorkflowAction Unlock workflow Admin
Microflows$NotifyWorkflowAction Notify workflow Wake a waiting workflow
Microflows$OpenWorkflowAction Open workflow admin page Navigation

These all fall through to default: return fmt.Sprintf("-- Unknown action: %T", action) in DESCRIBE, and cannot be created via MDL at all.

Impact

The most commonly needed action is GetWorkflowDataAction. When a microflow is used as a datasource for a workflow task page, the standard pattern is:

// In Studio Pro (not expressible in MDL today):
$Issue = GET WORKFLOW DATA FROM $Workflow;   // returns OrderManagement.OrderIssue

Without this, developers are forced to write invalid workarounds like:

-- WRONG: "System.Workflow" is not an association name on OrderIssue
RETRIEVE $Issue FROM OrderManagement.OrderIssue
WHERE System.Workflow = $Workflow
LIMIT 1;

This silently produces an empty result at runtime because the XPath constraint is invalid.

Proposed MDL Syntax

Priority 1: GetWorkflowDataAction

-- Get typed workflow context entity from a Workflow instance
$Issue = GET WORKFLOW DATA $Workflow AS OrderManagement.OrderIssue;

Maps to:

{
  "typeName": "Microflows$GetWorkflowDataAction",
  "outputVariableName": "Issue",
  "workflowVariable": "Workflow",
  "workflow": "OrderManagement.WF_DeliveryDelay"
}

Priority 2: WorkflowCallAction

-- Start a workflow from a microflow (replaces the current Java action workaround)
$WfInstance = CALL WORKFLOW OrderManagement.WF_DeliveryDelay ($Issue);

Priority 3: GetWorkflowsAction

-- Get all workflow instances for a given context object
$Workflows = GET WORKFLOWS FOR $Issue;

Workaround

Currently the only workarounds are:

  1. Manual Studio Pro editing after mxcli exec
  2. Custom Java Action wrapping Core.getWorkflowContext() / workflows().call()
  3. Redesigning to avoid the pattern entirely

Environment

  • Mendix: 11.6.4
  • mxcli: latest main

Metadata

Metadata

Assignees

No one assigned

    Labels

    enhancementNew feature or request

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions