For dynamic filtering of list, I'm trying to use javascript to call different nanoflows based on a list of filternames. Each name represents a nanoflow. The javascript then calls those nanoflows, passes a list to them by forwarding the returned list to the next nanoflow until all nanoflows have been processed. In this way you can select what filters to apply and in what order you want to do this. Since I don't know any JS I've been discussing with AI to construct a script. At first it didn't work at all, slowly we got to a point that it could iterate over a list but I still got errors regarding null and undefined values or calling flows that did not appear to exist. Ofcourse I checked the filename and included the module name. The script below is a stripped version that works only if the flow is a microflow. Can someone help me change this so that it calls nanoflows specifically and expand on its functionality to reach the expected endresult? // This file was generated by Mendix Studio Pro. // // WARNING: Only the following code will be retained when actions are regenerated: // - the import list // - the code between BEGIN USER CODE and END USER CODE // - the code between BEGIN EXTRA CODE and END EXTRA CODE // Other code you write will be lost the next time you deploy the project. import "mx-global"; import { Big } from "big.js"; // BEGIN EXTRA CODE // END EXTRA CODE /** * @param {string} nanoflowName * @param {MxObject} parameterObject * @returns {Promise.<MxObject[]>} */ export async function JS_CallFilters(nanoflowName, parameterObject) { // BEGIN USER CODE // Input parameters: // nanoflowName (string), parameterObject (MxObject) var nanoflowName = nanoflowName; // String - name of the nanoflow to be called var parameterObject = parameterObject; // MxObject - object to pass to the nanoflow // Use `mx.data.action()` to call the nanoflow mx.data.action({ params: { actionname: nanoflowName, // Fully qualified name (e.g., 'MyFirstModule.nanotest') applyto: 'selection', guids: [parameterObject.getGuid()] // Pass the object GUID to the nanoflow }, callback: function(result) { // This function will be called when the nanoflow completes successfully if (result) { // Assuming result is a list, you may want to handle it accordingly return result; // Return the list that comes from the Nanoflow } else { console.log("No result from nanoflow"); return []; // Return an empty array if no result is returned } }, error: function(error) { // Handle error console.error("Error executing nanoflow:", error); return []; // Return an empty array in case of error } }); // END USER CODE }