Currently its only possible to use objects as page parameters. It would be really useful to have the same options as in Microflows to pass for example strings as parameters:
UseCase 1:
If you want to show your own message popups with customized styling and icons etc. you can either duplicate the page for every message you want to show, which produces a lot of maintenance work. Or you use only one page and pass the message as a string parameter. Currently you need to create an additional object which has only that string as an attribute.
UseCase 2:
If you want to differentiate the caller of a page its handy to just pass a string as the source so that following actions on the page know from where it was opened. This is for example useful if you have multiple options for deleting an object and want to close the confirmation popup, sometimes you need to close 2 pages (when viewing the object itself on the page), sometimes only 1 page (when on a page with list of objects). Currently to do this you need to create a separate object in your domain model which has only a string attribute and pass this from the caller to the page. But this then requires a micro/nanoflow to call the page since a object needs to be created with dynamic content.
Enabling other parameter types for page parameters would solve those problems. For all types which are not object, or lists, even hardcoded or context object dependent values could be achieved.
Therefore this section on pages when calling other pages:
should be editable as it is in Microflows:
Hi Andries, thanks for pointing this out. Thats quite nice, but sadly not what my idea described :(
My idea aims at the other way around, on calling pages from flows and beeing able to have primitive arguments as page parameters. For example to have a custom "Error Popup" page which gets the text to show from a primitive string argument.
I hope this will be implemented in the future as well.
Implemented in Mendix 10.12 https://docs.mendix.com/releasenotes/studio-pro/10.12/#primitive-parameters-support-for-logic-called-from-pages
It is now possible to pass primitive values from pages to microflows and nanoflows. You can now use expressions to set primitive values as arguments (like a string or Boolean), use functions, and even follow associations! This can be used on triggering call microflow and call nanoflow client actions, and also as in data sources based on microflows or nanoflows.
Agreed, the required boilerplate just to get a basic number or string passed into a page is a bit ridiculous. You can't simply use 'Show A Page' and then dynamically enter in the basic data type, you have to create a "navigation" microflow which creates a new NPE entity, with a member attribute of that type, then show the page from the microflow. I should have to do all that is all I want to do is pass in a 1 to denote that the page should display something or not.
On the flip side however, it does make sense to use this pattern for cases where your page would have more than one input parameter. There is a very obvious drawback here then that it becomes very confusing when you try to have an input parameter that includes both simple types, and normal entities, since the only solution there is to create a new NPE which has the simple types with an association to the desired entity, then to fetch the desired entity from association off the NPE. It's all very confusion when most developers just want to pass in basic data like they would with URL parameters.
Yes, certainly!