Zoho Inventory Custom Field Update

Zoho Inventory Custom Field Update

Hello All,

In this post I am describing how can we Update the Custom Field Value in Zoho Inventory.

// Get Org ID
orgid = organization.get("organization_id");
// Field Value
resvp = ifnull(item.get("purchase_rate"),null);
// Record ID
iid = item.get("item_id");
if(resvp != null)
{
Fabritec_Buffer = (resvp.toNumber() / 0.94).round(2);
           // if you are not able to find out the custom value then you can by this
customfield = item.get("custom_fields");
      // Custom Field Map
      // Create a list because data will be go in map by the list form
customFieldList = List();
customFieldMap1 = Map();
      // Api Name of custom field
customFieldMap1.put("api_name","cf_fabritec_buffer_6");
      // Value
customFieldMap1.put("value",Fabritec_Buffer);
customFieldList.add(customFieldMap1);
updateItemMap = Map();
updateItemMap.put("custom_fields",customFieldList);
resvp1 = zoho.inventory.updateRecord("items",orgid,iid,updateItemMap,"zinventory");
// Get Update Result
info resvp1.get("item").get("custom_fields").getJSON("value");
}