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:
- range = 20;
- // 20 is the number of times the loop will run, you will need to give an appropriate number.
- val = leftpad("",range);
- //Insert 20 blank spaces.
- range_val = val.toList();
- loop_dec = 1;
- //loop_dec is the variable which will decide if the API call has to be executed or not
- fromindex = 0;
- toindex = 200;
- count = 0;
- for each element in range_val
- if (loop_dec != 0)
- crmresponse = zoho.crm.getRecords(("<Products>"), fromindex, toindex);
- // In our example, Products is the label name of Zoho CRM Custom Module from where the data has to be fetched
- for each element in crmresponse
- // Fetch the product_name and add it to the list called productlist
- if (resp.size() != 0)
- fromindex = (fromindex + 200);
- toindex = (toindex + 200);
- count = (count + resp.size());
- loop_dec = 0;
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.