Recommended way to insert Account and Contact simultaneously?

Hi everyone!

I’d like to be able to insert an Account with a related Contact simultaneously from the same page, to speed up the process. What is the recommended way to achieve this? Should I build a custom module with a form that takes both the Account and the Contact data and then creates the two Beans server-side?

Thanks for your advice!

I think is easier to add the contact field to account and use workflow to create the contact when account is saved. But keep in mind that fields are going to remain in account.

The cleanest way might be to create the a custom module and create the account and contact using workflow or logichooks

1 Like

I am not sure, but I don’t think you’ll need a custom module for that. Just a custom view.

Another approach would be to actually do it in a single module (say, accounts), but show a bunch of extra custom fields to the user. When he presses save, you copy that data to a Contacts bean, and never show those Account fields to the user again.

1 Like

Thanks everyone!

For the record here’s how I did it:

  • Created a viewdef for my new page containing fields for both account and contact info (inside custom/modules/Accounts/metadata)
  • Created a new view that displays the above viewdef (inside custom/modules/Accounts/views)
  • Created a custom Accounts controller (custom/module/Accounts/controller.php)
  • Added a new action (1) to the controller that displays the above view
  • Added a new action (2) that saves the data submitted by the view (account + contact + relationship between them)
  • Added the new action (1) to the Accounts’ left menu (inside custom/Extension/modules/Accounts/Ext/Menus)
1 Like

Hello @fanton.ff

This is interesting, could you please share more details on how to achieve this? It would be very useful for everyone.

Thank you.