Creating multiple Child Objects via Checkboxes/Buttons

Hi everyone, my domain model looks like this: I want to have a multi-select option inside the Person-Dataview that creates an object for each selection.  I don’t care if the multi-selection is a checkbox or a button. The Persons-Dataview page should look similar to this: If the person for example selects 2 and 3, I want to create an child object of “FavoriteNumbers” for each number. And I want the view to change to a similar version to this: I was able to create a new object on each button via a microflow and set it to the corresponding value, and display another “selected” blue button inside the following “FavoriteNumbers” ListView (over association) but I wasn’t able to “hide” the original button. Besides, my “solution“ doesn't feel very elegant. But now I have 2 buttons for every number. Do you have any idea how to solve this better and cleaner? Thanks
3 answers

Hi Marvin,

I think your button solution isn’t that bad: create a ‘default’ button that sets the association, and a ‘primary’ button that removes it.

You can use conditional visibility to make sure only one of them is visible: use an expression to check on the specific association, show one when it’s empty, and one when it isn’t.


Hi Marvin, 

I didn’t notice that you only have 1 association: favoritenumbers_person. 

That means your data model needs some extra attributes or associations, which hold information on this relationship. You can choose for associations: next to the existing one, there needs to be an association per button/selectable value. On the button, select ‘based on expression’ in the ‘visibility’ submenu and check on the specific association to be empty or not. When a person clicks the button, create/delete the object and set/empty the association.

Alternatively, you can create booleans on the person object which you set on a button click triggered microflow, and base conditional visibility on this. This isn’t the prettiest solution though.

Finally, using only the existing association you have, you could choose to add a ‘checked’ boolean to the ‘favouriteNumber’ entity. Make sure to generate (if necessary) all objects (one for each selectable value) before/when a user enters the screen, and use the ‘Number’ attribute as button caption. the button checks/unchecks the ‘checked’ boolean, which you can use to determine which button to show. Use a template grid for displaying the objects, or a listview that shows items horizontally (use the forum to see how to achieve this, is can be done pretty easy).


Which option to choose depends on how flexible you want the solution to be: the third option could even be generated/based on a run-time configurable list of selectable options, opposed to the first solution which would require a change to your data model every time an option needs to be added.

Good luck!


Hi Wieke, thanks for your answer. 

would you then create the association & the new object via a microflow? And how would you delete the object and the association again?

If I understand you correctly,  you would place both the default and the primary button in the parent data view "Person" and make their visibility dependent on the existence of the association to the child object.
Can you explain in more detail how I make the visibility of the buttons dependent on the existence of the association? And what expression do I use for that?