Creating Multiple Contact Records via Form Submissions
This tutorial covers implementation of a registration form that will create two or more Individual contacts, with relationship to a
Company contact.
There are three types of Relationship:
Individual to Individual - This relationship is between two Individual contacts. It uses prefix of 'I2I_'. For example:
I2I_Parent
I2I_Guardian
Individual to Company - This relationship is between a Company contact and an Individual contact. It uses prefix
'I2C_' followed by the relationship term. For example:
I2C_AccountsContact
I2C_Owner
Company to Company - This relationship is between two Company contacts. It uses prefix of 'C2C_'. For example:
C2C_Supplier
This tutorial will focus on Individual to Company relationship. To learn more about Companies and Relationship, read
this article.
Company with Individual Contact
The form below will create two types of contact and create an "Owner" relationship between the Company Information and
Primary Contact.
Company Contact
Company Name
Phone Number
Email Address
Relationship [hidden]
Individual Contact
First Name
Last Name
Phone Number
Email Address
The Form
To get started, add the following form code to a page:
The form field for the Company Information has the same following commonly used attributes:
id="contact_company_[FIELDNAME]"
If your form will create a new contact record in the database, each form field should use ids that match the contact database fields. (eg.
use contact_company_phone, contact_company_email, contact_company_phone_work). You
can view all contact fields here via the API reference.
Create a hidden field to assign the relationship between two contacts. In this example, the relationship is I2C_Owner. Default:
I2C_Employee
Company with Multiple Individual Contacts
You can expand on the above form to allow additional Individual contacts to be associated with a Company. This approach is commonly used to
extend Company Information with multiple contact relationship.
In the example code below, the Form will create a Company Contact and three (3) Individual Contact with Owner, Manager, and Employee
relationship respectively.
1. Add field for datacolumn="contact_relationship_id" value="I2C_Manager" to assign
relationship between Company and Individual contact. In this example, we will assign the contact to Manager
relationship. Note: Use a different ID per contact to avoid overriding the contact_relationship per contact.
2. Add field for datacolumn="contact_company" value="COMPANY_NAME". This will define the
Company contact associated with the Individual contact. In the example above, it uses ss:ajax:event
to populate the company name from the user input above the form.
3. When adding contact fields for the Additional contact, make sure to assign a unique ID per field then use
datacolumn="" to link the form item to a Contact
Field.
Other Optimisation:
Allow Relationship Type to be selected by the user: