Custom Function to get custom field of lookup type in Books

Custom Function to get custom field of lookup type in Books

Hi,

Here's the situation.

In Purchase Order, there is a custom field (lookup) to SO.
The requirement is to update to the related SO if PO get updated

Right now facing challenge to get the id of custom field (lookup) in PO.
Please find below the sample script:
info cfso; is the custom field, but return null

----------------------------------------------------------
----------------------------------------------------------

poID = purchaseorder.get("purchaseorder_id");

organizationID = organization.get("organization_id");

poinfo = zoho.books.getRecordsByID("purchaseorders",organizationID,poID,"zbooks").get("purchaseorder");

delivery_date = poinfo.get("delivery_date");

info delivery_date;

cfso = poinfo.get("cf_sales_order");

info cfso;

mplist = List();

mp = Map();

mp.put("api_name","cf_expected_delivery_date");

mp.put("value",delivery_date);

mplist.add(mp);

info mp;

json = Map();

json.put("custom_fields",mplist);

update = zoho.books.updateRecord("salesorders",organizationID,cfso,json,"zbooks");
----------------------------------------------------------
----------------------------------------------------------

Thanks