Allow snippets to accept multiple entities optionally as argument. The higher level objects of a page can be needed inside the snippet. - Mendix Forum

Allow snippets to accept multiple entities optionally as argument. The higher level objects of a page can be needed inside the snippet.

2

Allow snippets to accept multiple entities optionally as argument. The higher level objects of a page can be needed inside the snippet. 

Now all widgets can access higher level entities inside a page. Then why could not snippet access multiple?

I guess originally they were created just like pages which accept one entity. But they are not pages, instead they are like visual function calls. So to make these snippets more reusable please allow multiple arguments and even allow them to be empty when called from a page.

asked
2 answers

Yea simplicity of this tool is the key differentiator. But what I meant was that when a microflow is invoked from a screen, the arguments are optional for the microflow. e.g. If the screen contains 3 levels of objects to offer to the microflow, the microflow can choose to declare one or two or three arguments depending on what it is interested in. Similarly if snippets could also have that flexibility. Hopefully that does not encourage us developers to misuse the flexibility and keep reusability and maintainability in mind.  

Created

I understand your idea, but I do no agree.

The higher level objects of a page can be needed inside the snippet. 

This makes the snippet less reusable, less flexible and less readable. In my opinion, reusability is also simplicity: call the snippet and you’re done.

Also, in for example microflows, arguments are also not optional. You need to provide each argument.

Created