Accessing Custom Fields within Deluge Custom Button Script

Accessing Custom Fields within Deluge Custom Button Script

Hello, 

I am just getting started in customizing the Zoho Inventory App by adding custom buttons. I am trying to access custom fields that have been setup on the Purchase Order module with the following script: 

//This is a sample function. It will display the reference number
referenceNumber = purchaseorder.get("reference_number");
lotQty = purchaseorder.get("cf_number_of_lots");
resultMap = Map();
resultMap.put("message","Reference number -" + referenceNumber + ", Number Of Lots - " + lotQty);
resultMap.put("code",0);
// 0 - Success ; Other than 0 will consider as failure
return resultMap;

No matter what happens, the lotQty variable always comes back with Null. I've checked and the cf_number_of_lots is the API name of the custom field. 

Any help will be greatly appreciated. 

Jim