Building a Subform

Building a Subform

Subforms - An Overview

In simple terms, a subform is a secondary form or a table, which will enable you to include multiple line items into a primary form.

Your CRM data are often inter-dependent. Often, you may have the necessity to associate multiple items to a single record. In technical lingo, we call these "line items". For example, while ordering a mobile phone, a customer may place the order for accessories such as mobile charger, flip cover and a microphone - along with the main product. So, these become "sub-products". While customer A orders these three accessories, customer B may order another 5. Each accessory may require essential information such as amount, rate, quantity, discount and so on.


This Accessories section in itself becomes a form - where you ask for details such as name of the accessory, price, quantity, vendor and so on. So essentially you have two forms:

  • primary product form, which contains details about the main order: mobile phone.
  • sub product form, which contains details about the associated accessories. This is nothing but a subform in CRM.

On a more technical perspective, subforms easily solve the need for you to establish a one-to-many relationship with data in your CRM, in which many secondary items are associated to a single primary record. The following "Scenarios" section offers examples from many industries to illustrate the purpose of a subform.

Scenarios

Subforms can be used in various scenarios. Some of them are outlined below:

Sales Sector: A subform to associate contact details to accounts

If you have many contacts that you are working with in a specific company, create a subform to jot down the details of the contacts.

Education Sector: A subform to associate academic details to a student

A Student application form may require the applicant to fill a complete section on Academic Details and Previous employment details, if any. This may contain details about the employer, job title, description and so on. While the primary form is still all about the student, the subform is a table with details about previous companies and associated information.

Insurance Sector: A subform to associate dependent details to an applicant

A life insurance form may ask an applicant to fill dependent details - this section would be a form in itself with details required such as Dependent Name, Age, Sex and other identity related information. While the primary form is still about the insurance policy holder, the subform is a table with details about his/her dependents.

Real Estate Sector: A subform to associate References details in a rental application form

A house rental or lease form could contain a section on Floor Plans. These could require details such as apartments, description, area etc. While the primary form is still about a property, the sub form could be about details about the houses under this property.

Building a subform

A subform is created using the layout editor. You will insert the required types of fields as "Columns" in a subform and add aggregate fields if required. The following sections break down the process of creating a subform in Zoho CRM.

To create a subform

  1. Go to Setup > Customization > Modules and Fields.
  2. From the list of modules, click the required module and layout. Example: Products module, Standard layout.
  3. In the layout editor, drag and drop the Subform block from the New Fields section on the left.
  4. Name the subform: Example: Sub Products. 
    Note that subforms are layout-specific. You can have entirely different subforms for Layout A and Layout B of the same module.

Inserting columns in a subform

In the subform, you must next insert the columns required. These columns are nothing but the different types of fields such as single line, number, currency, formula, pick-list field, lookup field and so on.

Association of fields from a lookup module

When you add a lookup field to a subform, you can also include fields of the lookup module. For example, when you add Vendors as the lookup module, you will be able to add fields from this module - "Vendor Email" and the like. As you fill line items in this subform, you will see that the Vendor Email field is automatically populated as you look up a vendor. You can edit this field in the subform any time.

Note that while you can associate fields from the lookup module to a subform, they are not in sync with the subform. That is, when you change a Vendor Email field, it is modified in the subform but not in the original Vendor module. This is because, you only make an association here, but not synchronization.
 

To insert columns in a subform

  1. In your subform, click Add Field. 
  2. From the Field Type drop-down list, click the required type of field.
  3. Name the field and set field properties.
    In case you insert a lookup field, you can add specific fields from the related lookup module.

Following are the type of fields you can include in a subform as the form's "Columns".

Single LinePick ListDecimal
Multi-LineMulti-Select Pick ListPercent
EmailDateLong Integer
PhoneDate/TimeCheckbox
NumberCurrencyURL
LookupFormula-

Here is a sample subform for a company that sells mobile phones. While a phone is their primary order, there could be sub products that include accessories. This subform includes columns such as the following:

  • Name of the accessory
  • Vendor (Lookup field)
  • Vendor Email (Field from Lookup module)
  • Rate
  • Quantity
  • Price
  • Discount
  • Amount.

Inserting an aggregate field

An aggregate field is one on which a mathematical function has been performed. Once you have included the columns, you can add an aggregate field if needed. Aggregate fields are of three types and they have been explained below. Consider the example of a mobile sale, where the mobile accessories are entered as line items in a subform called "Sub-Products". This table includes quantity, price, description, discount and so on. In this case, following could be the examples of the aggregate functions.

  • Predefined aggregate functions: 
    Predefined aggregate functions include SUM, AVERAGE, MAXIMUM and MINIMUM.
    For instance, you want to add up the Price column of all the line items. This can be performed by adding an aggregate field called Total Amount and applying SUM as the Aggregate Function on the Price column.
    When line items are entered in the Subproducts subform, the prices will be added up automatically.
  • Formula Functions: 
    For any other function apart from the predefined aggregate functions, you can define your own Formula Expression using the Formula Tab. For example, your Total Amount field is not a Sum of the total prices but Sum of Total Prices - Discount + Tax. This expression can be defined in the Formula Section appropriately.
    When line items are entered in the Subproducts subform, the entered function will be executed automatically.
  • Manual entries (New Fields): 
    In cases where you don't want the system to make these aggregate calculations, you can add a New Field. This new field can be a Currency Field, Number or Decimal Field. For example, you want to have an aggregate field called Adjustments, where entries are made on an ad-hoc basis manually. In this case, you can choose New Field, choose the type of field- say currency and add it as an aggregate field.

To add an aggregate field

  1. Click the Add Aggregate Field in the subform.
  2. In the Aggregate Field popup, choose from the following options:
    • Aggregate: A predefined set of Aggregate Functions of SumAverageMaximum and Minimum. Simply choose the Function type and the related field. CRM will automatically calculate the aggregate values based on the settings made here.
      Example: An Aggregate Function to display the SUM of Deal Amounts will add up all the Deal Amounts entered in the subform and display the Total Deal Amount. 
    • Formula: If the predefined functions are not suitable, you can define your your Aggregate Function using the formula section.

    • New Fields: If you do not want the system to perform the aggregate function, you can insert a new field as the aggregate field, such as Number, Currency or Decimal fields. In this case, you can enter the aggregate values manually.
      Example: You don't want the system to calculate the aggregate values. You enter a value for Adjustments manually.
Note
  1. The limits for the aggregate fields are included in the field limits of the parent module.

Setting field permissions in a subform

Once you have entered all the columns and aggregate fields, it's time to set the field permissions and field properties. Each column (field) in a subform can be granted access rights just like any other field in the layout. Simply click the More icon on the field and choose among the following options.

  • Mark as required: Mark this field as mandatory so that a record cannot be saved without a value for this field.
  • Set Permissions: For each profile with access to this field, you can set the permissions of Read and WriteRead Only or Don't Show.
    For instance, Deal Amount should be a Read Only Field for Sales Reps but can be a Read and Write field for Managers.
  • Edit Properties: Edit the settings of each field based on the field type. Example, Number of characters for String fields, Maximum digits allowed for Number fields and so on.
    You can also include Tool Tips to explain what is required for each field.
  • Remove Field: When you don't require a field, you can either delete it permanently or just remove it from this subform.
    When you only remove it from the subform, these are moved to the Unused Fields list of the form. To restore a removed field, go to the Subform Settings and select Unused Fields. From the list of fields, simply click the field once to restore it to the subform.

     

Edit subform properties

To edit the properties of a subform

  1. Click the Settings icon on the Subform section.
  2. Select Edit Properties from the drop-down list. You may edit the following settings.

    • Subform Name: Enter a name for the section.
    • Select Show Tooltip if required and enter the tip.
    • Select Maximum row entries allowed if you wish to limit the number of entries or rows in a subform. Enter the required number. The range allowed is 1-100 entries.
    • Select Re-order option for row entries if you want to allow your user to rearrange the order of the rows entered in a subform.

Check subforms field limits

To check the field limits in a subform

  1. Click the Settings icon on the Subform section.
  2. Select Subform fields left from the drop-down list.
  3. This will open a window with a complete set of details on field limits for each type of field in a subform and how many you have left to be used.

Deleting a subform

To delete a subform

  1. Click the Settings icon on the Subform section.
  2. Select Remove.
    The subform will be moved to the Unused Items section of the layout.
    You can restore it anytime from here or delete it permanently from CRM.

Add Subforms in Mail Merge Templates

You can add subfomrs that were created in a module, in mail merge template and send it to your customers.
For example, information such as details of accessories purchased, life insurance dependency details, history of educational details, etc. which are captured using subforms can be added to your mail merge template.

Create reports and dashboards based on subforms

While creating a report for a module, you can base it out of subforms present in the module. For example, when you create report for Products, where you have Sub-products as a subform, this Sub-products subform will be listed under Related Modules section.

If you want to pull up a report of each product and the Sum Total of its sub-products, you can easily get this information by creating a subforms-based report.

To create a report based on subforms

  1. Go to the Reports module.
  2. Click Create Report.
  3. Select the primary module. Example, Products.
  4. In the Related Modules section, select the required subform. Example, Sub-Products. 
  5. Click Continue.
  6. Choose the type of report. Example: Summary Report.
  7. Click Continue.
  8. In the Reports Representation section, choose the columns required from the Available Columns section and add them to the Selected Columns. Example, Amount, Discount, Quantity, Rate etc.
  9. Click Continue.
  10. Add any filters if required. Otherwise, RUN the report.
    You can also create dashboards from the reports thus created.

Points to remember

  • A subform is available in the Enterprise Edition and above.
  • You can create 2 subforms per module in the Enterprise edition and 5 subforms per module in Ultimate edition.
    • The maximum number of subform fields you can add in a layout is 8.
    • The maximum number of entries across all subforms on an aggregate is 200.
  • The number of aggregate fields you can create falls within the field limits of the parent module.
  • Subforms are layout-specific. You can have entirely different subforms for Layout A and Layout B of the same module. This includes the subform fields as well as the aggregate fields.
  • Subforms are not available for ActivitiesPricebooks and Purchase OrdersSales OrdersInvoices and Quotes.
  • While converting a lead or a quote, fields used in a subform will not be converted.
  • The fields used in subforms will not show up in the following areas.
    • Custom view columns.
    • Advanced filters
    • Layout rules
    • Blueprint validation
    • Webforms
    • Import / Mobile / Export
    • Global Search
    • Template merge fields
    • Validation rules
    • Workflow field update and criteria
      However, note that a subform's aggregate fields will be available in the above-mentioned places.
  • Fields used in subforms will show up in reports as secondary modules.
    • Related Articles

    • Building your extension

      Step 1: Extension Pre-requisites   Get access to Developer console Before you start building your extension, first you’ll need to set up a Zoho Sigma account by visiting https://sigma.zoho.com/ If you are an existing Zoho customer, you can get access ...
    • Office Integrator - Building Host Page with Editor Embedded

      For building a host page in order to embed the Zoho Editors Create an HTML page to host the iframe element with its url pointing to the editor URLs.  Since the editors are hosted within a host page, the host page can communicate with the frame easily ...
    • Building Custom Module

      Zoho Recruit offers several default modules for recruitment activities including Job Openings, Candidates, and Interviews. These modules have predefined business logic, including page layout, reports, and workflow automation, which feature limited ...
    • Building Formula Fields

      The Zoho Recruit formula fields allow you to define fields that can be populated with dynamically calculated data based on the values returned from other standard or custom fields. For example, in the Candidates module, if you have added a ...
    • Building Formula Fields

      The Zoho Workerly formula fields enable you to define fields that can populate dynamically calculated data based on the values returned from other standard or custom fields. For instance, an insurance company may need to determine, if the provided ...