Retrieving Zoho Inventory records by Category
We are attempting to get records from Zoho Inventory based on the category but are having some difficulties. Can someone please offer any insight on the following?
We began by attempting to add a query for the category_name field:
- query = Map();
- ...
- query.put("category_name","Accessories");
- ...
- inventory_response = zoho.inventory.getRecords("Items","12345",query,"zoho_inventory_connection");
This is not filtering the results that come back as there are records with a category_name of "" being returned. These are valid items in Inventory mind so it just appears that the field is not being filtered on.
We also attempted to filter be the category_id, just to see if that made any difference and this did work:
- query = Map();
- ...
- query.put("category_id", "951594000008375055");
- ...
- inventory_response = zoho.inventory.getRecords("Items","12345",query,"zoho_inventory_connection");
This response did filter to the few items we're looking for so that is a start.
However, we have a variety of Categories that we will want to use in various places and we are attempting to write a function that will simply take the category and do the rest of the work for us to take out a bulk of copy/paste code. As it stands, using the name of the category doesn't work and using the id is not developer friendly.
Can we either:
A) use any methodology to retrieve based on the category_name to maintain readability?
OR
B) find a function that will let us get the id for a category by name so we can translate from the former to the later as a part of the function?