Creating Records

Creating Records

This guide will help you with the following:
  1. Syntax
  2. Example
  3. Response Format
  4. Additional Examples
    1. Fetching ID of a record created using the zoho.crm.createRecord() task
    2. Creating a task with chosen Contact and Account lookups
    3. Creating a Lead record and adding a Note to it
You can create records in Extensions and Vertical Solutions using the zoho.crm.createRecord() deluge task.

Syntax

  1. <Response> = zoho.crm.createRecord(<module String>,<dataMap Map>,<optionalDataMap Map>);
where,
<Response> is the task response returned as a Map.

Parameters


Example

Create a Lead record and trigger associated workflows
Obtain as user input, the last name, phone number, and email address of the Lead and create a record with these details. The sample script is given below:
  1. newRecordInfo = Map();
  2. newRecordInfo.put("Last_Name",lead.get("Last_Name"));
  3. newRecordInfo.put("Phone",lead.get("Phone"));
  4. newRecordInfo.put("Email",lead.get("Email"));
  5. response = zoho.crm.createRecord("Leads",newRecordInfo,{"trigger":{"workflow"}});
  6. info response;
Explanation:
  1. The Lead details obtained as user inputs are populated in a map (newRecordInfo).
  2. {"trigger":{"workflow"}} ensures that all workflows associated with creation of a Lead is triggered.
  3. response stores the result of the action (success or failure with the ID of the newly created record).

Response Format

  1. {"Modified_Time":"2018-10-25T10:38:28+05:30",
  2. "Modified_By":
  3. {"name":"ZohoDemo","id":"3388926000000166021"},
  4. "Created_Time":"2018-10-25T10:38:28+05:30",
  5. "id":"3388926000000313001",
  6. "Created_By":{"name":"ZohoTest","id":"3388926000000166021"}
  7. }

Additional Examples

Fetching ID of a record created using the zoho.crm.createRecord() task
The sample script is given below:
  1. newRecordInfo = Map();
  2. newRecordInfo.put("Last_Name",lead.get("Last_Name"));
  3. newRecordInfo.put("Phone",lead.get("Phone"));
  4. newRecordInfo.put("Email",lead.get("Email"));
  5. response = zoho.crm.createRecord("Leads",newRecordInfo);
  6. info "response: " + response;
  7. id = response.get("id");
  8. info "id: " + id;
Response
  1. response: {"Modified_Time":"2018-10-25T10:45:26+05:30","Modified_By":{"name":"ZohoDemo","id":"3388926000000166021"},"Created_Time":"2018-10-25T10:45:26+05:30","id":"3388926000000314001","Created_By":{"name":"ZohoTest","id":"3388926000000166021"}}
  2. id: 3388926000000314001
 
Update a record using the record ID
The record in Leads module with ID 3388926000000314001 will be updated with the last name 'John'. The sample script is given below:
  1. updateMap = Map();
  2. updateMap.put("Last_Name","John");
  3. response = zoho.crm.updateRecord("Leads",3388926000000314001,updateMap);
  4. info response;
Response
  1. {"Modified_Time":"2018-10-25T10:50:15+05:30","Modified_By":{"name":"ZohoDemo","id":"3388926000000166021"},"Created_Time":"2018-10-25T10:38:28+05:30","id":"3388926000000313001","Created_By":{"name":"ZohoTest","id":"3388926000000166021"}}
 
Creating a task with chosen Contact and Account lookups
The sample script is given below:
  1. taskInfo = Map();
  2. taskInfo.put("Subject",task.get("Subject"));
  3. taskInfo.put("Description",task.get("Description"));
  4. taskInfo.put("$se_module","Accounts");
  5. contactInfo = {"name":"Arthur","id":"3388926000000285001"};
  6. taskInfo.put("Who_Id",contactInfo);
  7. accInfo = {"name":"Acme Inc","id":"3388926000000297008"};
  8. taskInfo.put("What_Id",accInfo);
  9. response = zoho.crm.createRecord("Tasks",taskInfo);
  10. info response;
where,
  1. $se_module can be Accounts, Leads, or Cases
  2. contactInfo is the map having Contact lookup details
  3. accInfo is the map having Account lookup details
Response
  1. {"Modified_Time":"2018-10-25T10:54:13+05:30",
  2. "Modified_By":{"name":"ZohoTest","id":"3388926000000166021"},
  3. "Created_Time":"2018-10-25T10:54:13+05:30",
  4. "id":"3388926000000314014",
  5. "Created_By":{"name":"ZohoTest","id":"3388926000000166021"}
  6. }
 
Creating a Lead record and adding a Note to it
The sample script is given below:
  1. leadInfo = {"Company":"Zoho","First_Name":"Mary","Last_Name":"John","Email":"mary.j@zylker.com","Phone":"14081234567","Street":"Elm Street","City":"Vegas","State":"Texas","Country":"USA"};
  2. resp = zoho.crm.createRecord("Leads",leadInfo);
  3. leadId = resp.get("id");
  4. noteInfo = {"Parent_Id":leadId,"Note Title":"Note for Contact","Note_Content":"This is a sample note","$se_module":"Leads"};
  5. response = zoho.crm.createRecord("Notes",noteInfo);
  6. info response;
Response
  1. {"Modified_Time":"2018-10-25T10:57:19+05:30","Modified_By":{"name":"ZohoTest","id":"3388926000000166021"},"Created_Time":"2018-10-25T10:57:19+05:30","id":"3388926000000316007","Created_By":{"name":"ZohoTest","id":"3388926000000166021"}}

    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








                                    You are currently viewing the help pages of Qntrl’s earlier version. Click here to view our latest version—Qntrl 3.0's help articles.




                                        Manage your brands on social media

                                          Zoho Desk Resources

                                          • Desk Community Learning Series


                                          • Digest


                                          • Functions


                                          • Meetups


                                          • Kbase


                                          • Resources


                                          • Glossary


                                          • Desk Marketplace


                                          • MVP Corner


                                          • Word of the Day


                                            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 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

                                                                                                      • Customization - Creating Custom Fields

                                                                                                        This guide will help you with the following: Custom Fields Custom Field Limits Add Custom Fields Edit Custom Fields Delete Custom Fields Create Currency Fields Add Pick List Values Add Multi-Select Pick List Values Create Lookup Field Create Auto ...
                                                                                                      • Automation - Creating Blueprints

                                                                                                        This guide will help you with the following: Introduction Building blocks of a Blueprint Designing a Blueprint Enter Basic Information Define Process Flow Configure Transition Settings Common Transition Points to Remember Introduction A Blueprint is ...
                                                                                                      • Creating New Modules and Fields

                                                                                                        The guide will help you with the following: 1. Manage custom modules  Add a new module Edit a custom module  Delete a custom module  2. Manage custom fields  Add a custom field  Edit a custom field   Delete a custom field  Create a currency field  ...
                                                                                                      • Fetching Records

                                                                                                        This guide will help you with the following: Syntax Example Response Format You can fetch records from a module in an Extension or Vertical Solution using the zoho.crm.getRecords() deluge task. Syntax <Response> = zoho.crm.getRecords(<module ...
                                                                                                      • Searching Records

                                                                                                        This guide will help you with the following: Syntax Example Response Format You can search records of a module in Extensions and Vertical Solutions using the zoho.crm.searchRecords() deluge task. Syntax <Response> = zoho.crm.searchRecords(<module ...
                                                                                                        Wherever you are is as good as
                                                                                                        your workplace

                                                                                                          Resources

                                                                                                          Videos

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



                                                                                                          eBooks

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



                                                                                                          Webinars

                                                                                                          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