Hi, I am new to custom functions but have managed to write into custom fields based on certain criteria when purchase orders are edited/changed. My problem is how to access (get) the warehouse name after I have
retrieved the warehouse_ID from the purchase order. It looks like I have a
data type problem or just don't have enough experience. Here is my code
(with missing statements).
POID = purchaseorder.get("purchaseorder_id");
POdate = purchaseorder.get("date").toDate();
ORGID = organization.get("organization_id");
wh = "";
WhID = ORGID;
WhID = zoho.inventory.getRecords("puchaseOrders",ORGID,"warehouse_id");
wh = WhID.toString();
/* This is just for testing if I have a valid warehouseID */
/* What is the datatype of warehouseID??*//* Here n eeds to be a "getRecordsbyID function?? like:
CustomFields = List();
CustomField = Map();
CustomField.put("label","Project");
/*This is the field I want to update)CustomField.put("value",wh);
CustomFields.add(CustomField);
json = Map();
json.put("custom_fields",CustomFields);
result = zoho.inventory.updateRecord("purchaseOrders",ORGID,POID,json);
So far my result in the custom field "project" is:
java.lang.Object@2d78211a
which might be the warehouse_ID??
Can anybody help fill in the blanks? Again, I would like to see the warehouse name in the custom field "Project".
Thanks so much (and stay safe these days)!