Concatenate two fields — (Combining two field values onto a third field)

Concatenate two fields — (Combining two field values onto a third field)

There are times when it is necessary to combine two separate field values into a single field. In such instances, we can concatenate two separate fields from the same module with the use of a custom function. For example, in one of the modules, we might want to concatenate First and Last names and display them as a single field called Name. This is just an example; you may apply the same custom function to any two fields you like.

Pre-requisites :
Create a field that displays the concatenated result. This field is not available by default so you have to add it to the page layout manually.
Go to Set Up > Modules and fields > Select the required module > Choose the layout you need to edit.

To create a custom function :
  1. Go to Setup > Actions > Functions > Configure Function > Write your own
  2. Provide a Function name, Display name and select the module as per required.
  3. Click on edit arguments, and map the required arguments. In this case, Lead ID, Lead first name and last name are required.
  4. Type the below given script and save.

Code :
leadDet = zoho.crm.getRecordById("Leads",Lead_id);
map = Map();
map.put("Name1",Lead_first_name + ' ' + Lead_last_name);
con = zoho.crm.updateRecord("Leads",Lead_id.tolong(),map);
info map;
info con;
Adding the custom function to workflow :
The key benefit of including a custom function in a workflow is that it can be utilized for any module. We integrate workflow rules, as well as any additional buttons and links, into every custom function we design.

Steps :
  1. Go to Set Up > Automation > Workflow rules > +Create Rule.
  2. Enter the required details and select the desired module.
  3. Select "On a record action" in the "When do you want to execute this rule?".
  4. Select "Create".
  5. Select the Condition as "All Leads".
  6. Choose "Function" from Instant Actions.
  7. Choose the desired function created by the user and click 'Associate'. In this the case the function name 'Concatenate'.
  8. Click Save.

Execution :
Fill out the form with all of the required information. When a new record is produced, the workflow rule is invoked. You can now check the leads module, and the results will be reflected. The 'Name' field combines the first and last name fields.

Other examples :
This custom function can also be used to concatenate additional fields.
1) For example, creating a title based on any of the other parameters. More than two fields can also be concatenated. In this case, a design firm follows a typical naming convention for a field called "Title". This includes their first name, company name, and the service (design) they selected. Fill up the required information. The title field has been left blank since it will be filled in automatically using the required fields.

2) Consider an educational institution that keeps track of student and staff information. The student's name and graduation year are required fields on the application. They usually pertain to different fields. What if the institute insists on having both displayed in the same field? In addition, the institute wants that field to appear in the business card view. This concatenate custom function can also handle this type of case.

Step 1 : Create fields accordingly, in this case 'Year of Graduation' field is added.

Step 2 : Write custom function that concatenate both the fields. Add the created function to workflow rules. Create a new field 'Students detail' which will display the concatenated result.
Code :
Stud_yop = zoho.crm.getRecordById("Contacts",cont_id);
map = Map();
map.put("Student_details",cont_name + ' ' + cont_yop);
yop = zoho.crm.updateRecord("Contacts",cont_id.tolong(),map);
info yop;
info Stud_yop;
Step 3 : Add the result field 'Student details' in business card view.
Step 4 : Create workflow rules for the function.

Note : We can also add 'last name' in the concatenation.

    Zoho CRM Training Programs

    Learn how to use the best tools for sales force automation and better customer engagement from Zoho's implementation specialists.

    Zoho CRM Training
      Redefine the way you work
      with Zoho Workplace

        Zoho DataPrep Personalized Demo

        If you'd like a personalized walk-through of our data preparation tool, please request a demo and we'll be happy to show you how to get the best out of Zoho DataPrep.

        Zoho CRM Training

          Create, share, and deliver

          beautiful slides from anywhere.

          Get Started Now

            Zoho Sign now offers specialized one-on-one training for both administrators and developers.

            BOOK A SESSION

                        Still can't find what you're looking for?

                        Write to us:



                            Zoho Marketing Automation

                              Zoho Sheet Resources


                                  Zoho Forms Resources

                                    Secure your business
                                    communication with Zoho Mail

                                    Mail on the move with
                                    Zoho Mail mobile application

                                      Stay on top of your schedule
                                      at all times

                                      Carry your calendar with you
                                      Anytime, anywhere

                                            Zoho Sign Resources

                                              Sign, Paperless!

                                              Sign and send business documents on the go!

                                              Get Started Now

                                                  Zoho SalesIQ Resources

                                                      Zoho TeamInbox Resources

                                                              Zoho DataPrep Resources

                                                                Zoho DataPrep Demo

                                                                Get a personalized demo or POC

                                                                REGISTER NOW

                                                                  Design. Discuss. Deliver.

                                                                  Create visually engaging stories with Zoho Show.

                                                                  Get Started Now

                                                                                          • Related Articles

                                                                                          • Types of Custom Fields

                                                                                            In Zoho CRM, you can add different types of custom fields as per your requirements. These fields will be available to all the users added to your organization's CRM account. Customize Zoho Defined Fields : You can edit, delete and hide some of Zoho ...
                                                                                          • Working with Custom Fields

                                                                                            In Zoho CRM, you can add new fields as per your requirements. These fields will be available to all the users added to your organization's CRM account. Customize Zoho Defined Fields: You can edit, delete and hide some of Zoho defined fields, but note ...
                                                                                          • Marking Personal Fields

                                                                                            GDPR defines personal data as any information relating to an identified or identifiable natural person (i.e. the data subject). There is a wide range of personal data that includes email addresses, location, mobile numbers, identification numbers, ...
                                                                                          • Building Formula Fields

                                                                                            The Zoho CRM 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 date of ...
                                                                                          • How do I combine two single line fields using a formula field?

                                                                                            You can use Zoho CRM formula fields to set up fields that can populate dynamically calculated data based on the values returned from other standard or custom fields. For example, you want to combine the First Name and Last Name fields in the Contacts ...
                                                                                          Wherever you are is as good as
                                                                                          your workplace



                                                                                            Watch comprehensive videos on features and other important topics that will help you master Zoho CRM.


                                                                                            Download free eBooks and access a range of topics to get deeper insight on successfully using Zoho CRM.


                                                                                            Sign up for our webinars and learn the Zoho CRM basics, from customization to sales force automation and more.

                                                                                            CRM Tips

                                                                                            Make the most of Zoho CRM with these useful tips.

                                                                                              Zoho Show Resources