get("id").toLong()

get("id").toLong()

Trying to write a function that searches for a record in a custom module.  When it finds that record, I need the record ID, so that I can update it.

appid is passed in as an argument.

ref = zoho.crm.searchRecords("Referrals", "(Application:equals:"+appid+")");
refid = ref.get("id").toLong();

It is finding the record, but won't extract the id.  I get the following error:

Failed to execute function
  • 'TEXT' can not be cast to '[BIGINT]' for the function 'get' Line Number:4
I understand that it is because "id" is a BIGINT and it is trying to put it in to a TEXT variable... but isn't that what toLong() is supposed to rectify?

I am very confused.  Any help greatly appreciated.