Trying to integrate Zoho Invoice to CRM

Trying to integrate Zoho Invoice to CRM

I would like to use a custom function to create a Potential in CRM whenever an estimate is sent. Having some difficulty.

1. How does Zoho link a Invoice customer_id with a Contact or Account id in CRM?

2. Currnently, I find the Company-name from the estimate and then look it up the Account in CRM. That is working. When I try to read the ACCOUNTID, I get a "Text can not be cast to Number message. Here is the offending code...


CustName = estimate.get("customer_name");
Cust = zoho.crm.searchRecordsByPDC("Accounts","accountname",CustName);
AcctID = Cust.get("ACCOUNTID");

The last line causes the error. I am able to see the contents of Cust and there is definitely data in there called "ACCOUNTID". I just can't read it in this custom function.