getRecords - Avoid duplicates
Hello community,
I'm maintaining a Vendors table in creator, fetching data from Zoho Books. The vendor table can not contain duplicates for consistency in the records of my app. That's why I've checked the "No Duplicates" option on the contact_id fetched from Books.
The issue now is that everythime I'm running the function to get records, I receive an error message because of finding duplicate values. How can I skip duplicates in the function below ?
Thanks a lot for your help.
- void Get_Suppliers()
- {
- query_param = Map();
- query_param.put("contact_type","vendor");
- response = zoho.books.getRecords("vendors","00000","query_param","booksconnection");
- data = response.getJSON("contacts");
- for each getdata in data
- {
- vendor_name = getdata.getJSON("vendor_name");
- contact_id = getdata.getJSON("contact_id");
- contact_type = getdata.getJSON("contact_type");
- insert into SUPPLIERS
- [
- SUPPLIER_NAME=vendor_name
- SUPPLIER_ID=contact_id
- CONTACT_TYPE=contact_type
- Added_User=zoho.loginuser
- ]
- }
- }