Hi Andreas,
as far as I know, it is not possible to pass two or more objects to a microflow via the JavaScript API which are of different types. You can only pass multiple GUIDs of the same type, which results in a list of objects (same type) as the parameter.
You could use something like a wrapper object, which is associated to the two objects you want to pass as parameters and in the microflow you retrieve them via those associations.
After a little further research, it appears that using mx.onlineData.executeMicroflow allows for calling microflows with multiple objects of different types.
The mx.onlineData API namespace doesn't appear to be documented yet, so this is taken from a trial-and-error approach.
mx.onlineData.executeMicroflow("MyFirstModule.DS_Test_Multiple_Objects", {
"FirstParameter":{
"guid":"12345678901234567"
},
"SecondParameter":{
"guid":"23456789012345678"
}
}).then(console.log);
2024 update
mx.data.action allows for at most 1 non-list object of each entity type plust one list. This limitation comes from the JSON format of the "executeaction" action: all the non-list parameters are passed in the "context" array of guids and the parameter names are just unsupported. If you pass more than one GUID of the same entity type then on the server side one of them will be mapped to all parameters of this type and the others will be discarded.
The more advanced "runtimeOperation" action used by buttons and nanoflows allows passing the parameter names and values, but the JS API to call it is inaccessible from user scripts: the "runtimeOperation" action JSON is created by the inaccessible class OnlineData. The common function used for both "runtimeOperation" and "executeaction" is also inaccessible.
The public property mx.onlineData was removed from Mendix somewhere in 2020.
Finally, there's no way to directly call "runtimeOperation" using window.fetch() because the value of X-Csrf-Token received during login is also inaccessible.
Resolution: you probably can wrap window.fetch() and convert "executeaction" JSON into "runtimeOperation" JSON when necessary. The JSON format of "runtimeOperation" can be guessed by playing with the inaccessible OnlineData.executeMicroflow(). Currently, an istance of OnlineData can only be obtained by using the debugger.
The other parts of the JSON like "objects" and "changes" can be copied from "executeaction": mx.data.action does a good job filling them for you.