Deluge Error: "Data type of argument of function 'get' did not match required type [BIGINT]" when working with Lookup fields

Deluge Error: "Data type of argument of function 'get' did not match required type [BIGINT]" when working with Lookup fields

Hi everyone,

I’m facing an issue in Zoho CRM Deluge while working with lookup fields.

Setup:
Module: Monthly Bills
Field: Customer (Lookup → Accounts)
Module: Laundry Orders
Field: Laundry_Account_Name (Lookup → Accounts)
Field: Expected_Revenue (Currency)
Field: Order_Status (Picklist)
Use Case:

I created a custom button that:

Fetches Customer from Monthly Bills
Searches related Laundry Orders
Filters Delivered orders
Calculates total amount
Problem:

I get this error:

Data type of argument of function 'get' did not match required type [BIGINT]
Issue Details:

When I do:

customerField = bill.get("Customer");
customerId = customerField.get("id");

Sometimes it works, but sometimes it throws the error.

Observation:
Lookup field sometimes returns:
Map → {id, name}
Sometimes returns:
Direct ID (BIGINT / string)

Because of this inconsistency, .get("id") fails.

Question:
Why does Zoho return lookup fields inconsistently?
What is the correct way to safely extract lookup IDs in Deluge?
Is there a recommended pattern to avoid BIGINT type errors?

Any help would be appreciated.