I am facing an issue with a JavaScript Action in Mendix that is supposed to call both a Microflow (MF_test) and a Nanoflow (NF_test), passing a simple string parameter (text). However, there are two critical problems: The Microflow (MF_test) executes but always receives an empty parameter (text = empty). The Nanoflow (NF_test) does not execute at all and throws an error. What I Have Tried So Far ✅ Logging parameters before execution console.log() confirms that the JavaScript Action correctly creates the parameters: ✅ Params before sending to Microflow: { "actionname": "Main.MF_test", "applyto": "none", "params": { "text": "test text" } } ✅ Ensuring Microflow & Nanoflow are properly configured Both MF_test and NF_test have a single Input Parameter (text, Type: String). Both contain a Log Message that outputs received parameters: Received text in MF_test: {text} However, MF_test always receives empty as the value. Both Microflow and Nanoflow have execution permissions for all users in the application. ✅ Testing Parameter Conversion & Context Tried using String(testText) in JavaScript to force type conversion. Added explicit context: new mendix.lib.MxContext() to ensure proper execution. ✅ Security & Permissions Check The user has Execute permissions for both Microflow and Nanoflow. No entity security restrictions should be interfering. The JavaScript Code export async function TestMicroflowAndNanoflow() { const testText = "test text"; console.log("✅ Attempting to execute NF_test and MF_test..."); console.log("✅ Parameter to send:", testText); // 1️⃣ Nanoflow Execution mx.data.callNanoflow({ nanoflow: { module: "Main", nanoflow: "NF_test" }, params: { text: testText }, origin: this, context: new mendix.lib.MxContext(), callback: function (result) { console.log("✅ Nanoflow executed successfully! Result:", result); }, error: function (error) { console.error("🚨 Failed to execute Nanoflow:", error); } }); // 2️⃣ Microflow Execution const params = { actionname: "Main.MF_test", applyto: "none", params: { text: testText } }; console.log("✅ Params before sending to Microflow:", params); mx.data.action({ params: params, origin: this, context: new mendix.lib.MxContext(), callback: function (result) { console.log("✅ Microflow executed successfully! Result:", result); }, error: function (error) { console.error("🚨 Failed to execute Microflow:", error); } }); } Console Logs & Errors ✅ Console Output (JavaScript) ✅ Attempting to execute NF_test and MF_test... ✅ Parameter to send: test text ✅ Params before sending to Microflow: { "actionname": "Main.MF_test", "applyto": "none", "params": { "text": "test text" } } 🚨 Failed to execute Nanoflow: Cannot convert undefined or null to object ✅ Microflow executed successfully! Result: null 🚨 Mendix Log Output Received text in MF_test: (empty) This confirms that the parameter text is completely missing when it reaches MF_test. Questions for the Community Why is MF_test receiving an empty parameter, despite JavaScript sending a valid string? Why is NF_test not executing at all and throwing an error (Cannot convert undefined or null to object)? Is there something wrong with how Mendix handles JavaScript parameters when calling Microflows/Nanoflows? Could applyto: "none" be causing the parameter to be ignored? Are there known issues in Mendix 10+ where JavaScript Actions fail to pass parameters correctly? Additional Information Mendix Version: 10.20 Browser Used: Edge, Opera Security Mode: Production Any help would be greatly appreciated! 🙏
asked
Łukasz Walczak
1 answers
0
Hi Lukasz,
I don't see why you want to call nanoflows and microflows using a JavaScript action, other than learning/research purposes; as both actions already exist as activity in Nanoflows. Anyways:
As you can see in the Mx Client documentation, calling Nanoflows cannot be done by name; the whole nanoflow is an object which can only be passed as parameter to the JavaScript action. You then must select the Nanoflow design-time as parameter in the javascript action activity.
Calling a microflow using mx.data.action only accepts objects and lists of objects. It's not documented how you can call a microflow with primitive parameters or multiple parameters.