Kaizen #54 - Subforms vs. Related Lists

Kaizen #54 - Subforms vs. Related Lists

Hello everyone!
Welcome back to another week of Kaizen.
In this post, we will analyze how to choose between a subform and a related list based on your business case.

What will you learn from this post? 
  1. When to choose a subform?
  2. When to choose a related list?
  3. Comparing subforms and related lists
1. When to choose a subform?
Subforms are used to organize details in a record based on your business needs. Every line item is a subform record. To know more about subforms, refer to Kaizen #31 - Subforms #API.

1a. Business case
For instance, consider a scenario where you want to view all the necessary details of the stakeholders of an account, such as email ID, phone number, and so on while viewing an account record. 


For this, go to Setup > Modules and Fields > Accounts > Choose the desired layout and add a subform named "Stakeholders". In this subform, you can have a lookup field that points to Contacts (Stakeholders). You can further choose to add new fields or add fields from the Contacts module to the subform.

Adding fields from the Contact module to the subform:


Adding new/additional fields to the subform (it can be any of any field-type including aggregate/formula):


The system auto-populates the details of the stakeholder, based on the stakeholder name. Thus, allowing you to view all the necessary details of a stakeholder in a single glance. If needed, you can even add aggregate/formula fields to the subform.

Note:
The system automatically populates the values only if the value is present in that field in the child record.

For other sample business use cases, click here.

1b. Retrieving subform records along with parent record.
You can retrieve subform records only when you retrieve records with their unique ID. The system does not retrieve subform records when you retrieve all the records in a module, or perform a search operation.

Request URL: {{api-domain}}/crm/v2/Accounts/4150868000003247001
Request Method: GET

Sample Response:


You can also choose to retrieve just the subform records using Get Subforms API.

Note:
  • To know how to add aggregate fields to a subform, click here.
  • You can add formula fields to the subform. However, you can choose only the fields in the subform in your formula expression. Click here to know more about the formula fields.
  • 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.
2. When to choose a related list?
A record usually contains extra information such as notes, attachments, and data related to other modules (linked via lookup/multi-select lookup fields) such as related tasks, calls, products etc.These modules are categorized as related lists, and the records in each of these related lists are called related records. To know more about related lists, refer to Kaizen #48 - Related Lists and Related Records #API.

Let us try to solve the same business scenario as above using related lists.

The system lists all the related records (child) under a record (parent) based on the value in the lookup/multi-select lookup fields in the child records.

When you link an account while adding a contact, it will be directly displayed in the respective account's related list. You can show/hide the fields that are displayed in the related list based on your business needs. However, you cannot add additional fields as in subforms.

2a. Reasons why related list is not the best choice for this case:
  • You cannot add an aggregate field that calculates the stakeholder share.
  • You cannot add any formula field.
  • The related list data is auto-populated based on the value in the lookup/multi-select lookup field. 
2b. Business case for a related list
Consider a scenario where you need to view all the products that a contact is interested in. You can have a contact multi-select lookup in the products module. As and when you add product records with related contacts, it will be listed as related records in the respective contacts. This way you need not switch between modules to view the related records.


3. Comparing subforms and related lists

Here is a comparison between the subforms and related lists. 
Subforms
Related lists
Primarily used to organize data in a record based on your business needs.
Primarily used to perceive parent-child/one-to-many relationships between records. 
Allows you to add new fields (both normal and aggregate).
You can only display/hide the fields of the child record. 
You cannot configure workflow rules based on subform fields (except aggregate fields)
You can configure workflow rules based on related lists.
Subforms are layout-specific.
Related lists remain the same for all the layouts in a module. 
Subforms not available in Activities, Pricebooks and Purchase Orders, Sales Orders, Invoices and Quotes
The system creates related records when you add values to lookup/multi-select lookup fields. It is available in all the modules except Activities.
While converting a lead or a quote, fields used in a subform will not be converted.
While converting a lead or a quote, the related list data will be retained in the converted record. 

We hope you found this post useful. Let us know your thoughts in the comment section or reach us out at support@zohocrm.com.

Cheers!

      Zoho Developer Community









                                Zoho Desk Resources

                                • Desk Community Learning Series


                                • Digest


                                • Functions


                                • Meetups


                                • Kbase


                                • Resources


                                • Glossary


                                • Desk Marketplace


                                • MVP Corner


                                • Word of the Day



                                    Zoho Marketing Automation


                                            Manage your brands on social media



                                                  Zoho TeamInbox Resources

                                                    Zoho DataPrep Resources



                                                      Zoho CRM Plus Resources

                                                        Zoho Books Resources


                                                          Zoho Subscriptions Resources

                                                            Zoho Projects Resources


                                                              Zoho Sprints Resources


                                                                Qntrl Resources


                                                                  Zoho Creator Resources



                                                                    Zoho WorkDrive Resources



                                                                      Zoho Campaigns Resources


                                                                        Zoho CRM Resources

                                                                        • CRM Community Learning Series

                                                                          CRM Community Learning Series


                                                                        • Tips

                                                                          Tips

                                                                        • Functions

                                                                          Functions

                                                                        • Meetups

                                                                          Meetups

                                                                        • Kbase

                                                                          Kbase

                                                                        • Resources

                                                                          Resources

                                                                        • Digest

                                                                          Digest

                                                                        • CRM Marketplace

                                                                          CRM Marketplace

                                                                        • MVP Corner

                                                                          MVP Corner





                                                                            Design. Discuss. Deliver.

                                                                            Create visually engaging stories with Zoho Show.

                                                                            Get Started Now