Javascript action to call microflow with list as parameter

0
Hi everyone, I have a microflow which has a list of objects as parameter. From client side, I trigger a javascript call to the microflow. The strange thing is that, if I have more than 1 object in the list, the microflow recognize the list correctly. If I have just 1 in the list, the microflow see the list as empty. For example: mx.data.action({ params:{ actionname: "MyFirstModule.microflow_multiple", applyto: "selection", guids: ["4785074604081157","4785074604081156"] }}) Will be correct, the microflow has a list of 2 objects. However, if I call mx.data.action({ params:{ actionname: "MyFirstModule.microflow_multiple", applyto: "selection", guids: ["4785074604081157"] }}); The list (paramter of microflow) will be empty. I don't know if this is a bug or an intended behavior of Mendix? Regards,
asked
5 answers
1

I ran into this issue myself and it seems to be Mendix's intended behavior, but I can't say for sure since I don't work for them.

But I will say it's not something you're doing wrong, and can also attest to this behavior.

answered
1

For me, It seems like a bug more than an intended behavior. A workaround could be found if you inspect the request from a microflow which takes list as paramter when you config datagrid as multiple-selection. It will look like this:

{"action":"executeaction","params":{...","applyto":"selectionset","xpath":"//MyFirstModule.Entity","constraints":"[id=\"4785074604081155\"]",...,"actionname":"MyFirstModule.microflow_multiple"}...}}

answered
1

I have this too with my new DataTables widget. Workaround is simple: define both a list and object parameter of your entity and check which one is not empty.

A model share: https://modelshare.mendix.com/models/32a4267e-3514-4809-b57f-9f44b2524468/example-of-js-function-calling-mf-with-list-parameter

answered
0

workaround

 mx.data.action({
                        params:{
                            actionname: microflow,
                            applyto: "selectionset",
                            //guids: guids,
                            xpath: "//MyFirstModule.Entity"
                            sort:[["id","asc"]],
                            constraints:arrayToConstrains(guids)
                        }
                    });
answered
0

Does anyone have offical solution for this issue yet.

It still happens in mx5.21.2 and I can't use the workaround

answered