Tip 10: How to fetch data from a custom module in Zoho CRM.

Tip 10: How to fetch data from a custom module in Zoho CRM.



Hi Folks,

A fortnight has gone by, and we are back with a new tip that would help you fetch data from a custom module in Zoho CRM and use it in a form created in Zoho Creator.

As you may already know the default integration field does not list the custom modules that you have created in Zoho CRM. The current integration task will only allow you to choose from the default list of modules available in Zoho CRM (as show in the below-given image).


However, if you want to fetch data from a custom module that you have created in Zoho CRM you need to code to do that.

For example, let's say you have a module called Products in Zoho CRM and you need to fetch the names of all the Products from that module and use it in a form called Place Orders in your Zoho Creator application. How do we do this?

You can achieve this by creating a list to dynamically fetch data from the Products Module and populate them in a drop-down field in the Place Orders form. Although, the Fetch data task will only allow you to fetch 200 records at a time using API. That's why, you need to write a script that will help you fetch data in specific ranges.

Let's see how to do this:

  1. range = 20;
  2. // 20 is the number of times the loop will run, you will need to give an appropriate number.
  3. val = leftpad("",range);
  4. //Insert 20 blank spaces.
  5. range_val = val.toList();
  6. loop_dec = 1;
  7. //loop_dec is the variable which will decide if the API call has to be executed or not
  8. fromindex = 0;
  9. toindex = 200;
  10. count = 0;
  11. productlist=list();     
  12.  for each element in range_val
  13. {
  14. if (loop_dec != 0)
  15. {
  16. crmresponse = zoho.crm.getRecords(("<Products>"), fromindex, toindex);
  17. // In our example, Products is the label name of Zoho CRM Custom Module from where the data has to be fetched
  18. for each element in crmresponse       
  19. {
  20. productlist.add(element.get("product_name"));   
  21. // Fetch the product_name and add it to the list called productlist
  22. }
  23. if (resp.size() != 0)
  24. {
  25. fromindex = (fromindex + 200);
  26. toindex = (toindex + 200);
  27. count = (count + resp.size());
  28. }
  29. else
  30. {
  31. loop_dec = 0;
  32. }
  33. }
  34. }
  35. input.Dropdown:ui.add(productlist); 

Hope you got a fair idea on how to fetch data from a custom module in Zoho CRM. Keep watching this space for more such tips.



    Access your files securely from anywhere

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


                                                                          Zoho CRM Resources

                                                                          • CRM Community Learning Series

                                                                            CRM Community Learning Series


                                                                          • Kaizen

                                                                            Kaizen

                                                                          • 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