Disabled action buttons on pages
Consider a page which has an action button (calling either a microflow or nanoflow) with multiple page parameters which are also parsed to that flow. The action button expects a certain set of input parameters (defined by the microflow/nanoflow). But it could happen that when showing the page not all parameters have a value (empty object). This works fine for the page, but the action button on that page will be disabled if any of its input parameters are missing. Any other action buttons not requiring that parameter will be clickable.
The behaviour has been confirmed and works as intended (according to Mendix support), and passing empty parameters to a page would be considered a feature request.
Q: Why is the action button disabled if one of the input parameters for its microflow/nanoflow is missing?
A: The action button is disabled because the object expected by the microflow/nanoflow is not present in memory when you are on the page which contains the button. It does not know to expect an empty object and gets a null reference instead. The button is disabled because it cannot be used to call the flow. Or as Mendix Support puts it:
Microflows can run when you parse them an empty object, but in this case, the microflow runs in the context of the webpage in which the object reference does not exist. Hence the microflows do not know to expect an empty object, because in essence it now gets a null reference.
Possible workarounds:
- Before showing the page, check if all the page parameters that are also parsed to flows exists, else create a dummy object and pass that to the page
- Create associations between the object that is present and the object that you only need sometimes. Determine in the action button logic if you need those objects and retrieve them over association from the page parameter.
Checked in Mendix 9.24.3 (Web and Native)