Information for: DEVELOPERS   PARTNERS   SUPPORT

Using one form for multiple contacts

Overview

A standard use-case while using forms is the ability to use a single form to create or update multiple contact records in Campaign Studio. This use-case is applicable to business referrals, partner deal registrations, and sending e-cards, etc.

To use this feature, you must perform the following two primary steps:

Creating forms

To use one form for multiple contacts, you must create two forms in Campaign Studio. While a single form appears on your website or landing page, the system shares data with the other form. Hence, you’ll receive two form submissions even though a contact submits only one form.

The parent form contains all the fields that you want a person to see on your landing page or website, including fields for the form-submitter and for the second contact you’d like to have created or updated.

You don’t need to map all form fields to a contact record. However, if you’d like to track information for the referrer on the referee’s record, you may want to create custom fields for that data and map the form fields to those contact fields.

To illustrate the process, let’s consider that you’ll create two forms. The first form contains seven fields while the second form contains three fields.

To create the first form:

  1. Log in to Campaign Studio, go to Components > Forms, and click New.

  2. Set a name for the form and enter the relevant details.

  3. Under Fields, create the following fields:

    • Contact 1 First Name
    • Contact 1 Last Name
    • Contact 1 Email
    • Contact 2 First Name
    • Contact 2 Last Name
    • Contact 2 Email
    • FormID

    Note

    You won’t be able to completely configure the FormID field until you’ve created the second form. For more information, see Creating FormID field.

  4. Map the first three fields for Contact 1, such as Contact 1 First Name, Contact 1 Last Name, and Contact 1 Email to the appropriate fields under the Mapped Field tab in the form field editor. For example, the Contact 1 First Name field should be mapped to First Name.

    Map_fields

    Ensure that you leave the last four fields unmapped.

    Map_fields_1

  5. Save the first form.

To create the second form:

  1. Access the same instance where you have created your first form.

  2. Go to Components > Forms, and click New.

  3. Set a name for the form and enter the relevant details.

  4. Under Fields, create the following fields:

    • Contact 2 First Name
    • Contact 2 Last Name
    • Contact 2 Email

    Tip

    You may achieve this quickly by cloning the first form and deleting all but the above fields from that form.

  5. Map these three fields for Contact 2 to the appropriate fields under the Mapped Field tab in the form field editor. For example, the Contact 2 First Name field should be mapped to First Name.

    Map_fields_7

    Map_fields_2

  6. Navigate to the Attributes tab and copy the value of Field HTML name for all the three fields. You’ll need these values for future use.

    Map_fields_3

Posting results to another form

Once the two forms are created, you must configure an action on the first form so that the results from the first form can be pushed to the second form.

  1. Access the first form, go to Actions, and select Post results to another form.

    Map_fields_8

  2. Set a name for the form action.

  3. In Post URL, set the URL to post the first form results to the second form.

    This value should in the following format:

    https://{instancedomain}/form/submit?formId={destinationId}
    
    For example,
    
    https://instance.campaignstudio.net/form/submit?formId=2
    

    Here, {instancedomain} is the custom domain for your instance and {destinationId} is the ID for your second form that should receive the results from the first form.

  4. (Optional) If you or your team members need to be notified in case of any errors with posting form results to a second form, specify all such email addresses in Post failure notification email.

  5. Under (Optional) Override field names for the receiving form, leave all the fields related to Contact 1 blank. For the fields relating to the second contact that you want to push to the second form, use the format mauticform[fieldalias], where fieldalias is the value of Field HTML name field under the Attributes tab for the specific field of the first form. In our example, Contact 2 First Name should have a value of mauticform[contact_2_first_name].

  6. Save the action and the form.

  7. Open the form preview page and complete the form. Ensure that the two email addresses are different.

  8. Observe the form results for both forms and the activity histories for both contact records. You should see the results in all the four places.

Creating FormID field

You must create a hidden field called FormID in the first form. This field helps establish the connection between the two forms.

To create thie field:

  1. Take a note of the form ID for the second form. To find the form ID, go to Components > Forms and locate the destination form. The ID number is in the far right column.

    Map_fields_6

  2. Return to editing the first form and add a new field, using the Hidden field type.

    Map_fields_4

  3. Specify the Label for the field, set Save result to No, and set Default value to the form ID of the second form.

    Map_fields_5

    Note

    You can’t have space or underscore in the Label. Acquia recommends that you use FormID as the label, which automatically generates a usable alias of formid.

  4. Save the field and the form.