Adding multiple associations to an object

0
I would like to use a page on my app which allows me to add an association to a client. I have associated my client entity to the Account entity in the Administration module. I want to be able to associate multiple Accounts to single client. I have used a 1 to Many association for account to client (one account can be associated to multiple clients). I have created a button on the page where I can add clients, which passes the selected client to the page where I can add associations to the account. On this page, I then have a reference selector to choose the account I want to associate the client to. At the moment, using a simple save changes button overwrites the association. I know that I can add the association instead of setting it in the Change Item activity. I am having a hard time passing the account that I selected in the reference selector to the microflow as I get the following error when trying to add the account object as a parameter in the microflow I want to trigger to add the association when clicking save. The error I get is CE1574: Parameter ‘Account’ of the selected microflow/nanoflow does not match available arguments. Arguments available to ‘actionButton1’ is object of dataView1 (Client). I understand the above error occurs because I have set the data view parameter as client, and that my client selection is passed from the previous page. How do I get it to pass both the client and the account to the microflow, and then add the association on top of the associations that already exist rather than overwrite them?  
asked
2 answers
4

Use ‘add’ instead of ‘set’ in the activity “Change Object” for Customer where you change its association:

 

answered
1

As an update to the above, I have taken a different approach to addressing the problem:

  • As stated above, I have an overview page for clients which I can add new clients to
  • To this I added a button which opens a new page to add account associations to clients (passes selected client to this new page)
  • The association between the client and account entity was set to many to many
  • I used a reference set selector to enable me to add and delete associations, the page: https://docs.mendix.com/refguide/reference-set-selector  was very useful
  • I right clicked the add button and generated the page to select the accounts I want to associate with client

 

I need to now make sure it works, but I have checked the sql database viewer (can be found under the Advanced tab in Console tab), and it does create the associations in the relevant association table. Hope this helps.

answered