Deluge Script - "Mismatch of data type expression" Error When Retrieving Account ID

Deluge Script - "Mismatch of data type expression" Error When Retrieving Account ID

Hi everyone,

I'm working on a Deluge Script in Zoho Creator to create Accounts and Locations. I'm running into a "Mismatch of data type expression" error when trying to retrieve the ID of a newly created Account.

Here's the relevant part of my code:

  1. accountResponse = zoho.crm.createRecord("Accounts", newAccount);
  2. info "Update Response: " + accountResponse;

  3. // ... (error handling) ...

  4. recordDetails = accountResponse.get("Details");
  5. accountId = recordDetails.get("id").toLong(); // This line throws the error

  6. // ... (rest of the code) ...

The error message says: "Error in executing On Create / Edit - On Success script Mismatch of data type expression. Expected BIGINT but found STRING."

Here's what I've tried so far:

  • I've confirmed that the id field in my Accounts module is an integer type.
  • I've used toLong() to convert the id to a BIGINT.
  • I've printed the accountResponse and recordDetails to check their structure.

The response from zoho.crm.createRecord looks like this:

{
  "Modified_Time": "2025-01-16T16:14:10-05:00",
  "Modified_By": {
    "name": "Troy Hutchinson",
    "id": "2073479000082155001"
  },
  "Created_Time": "2025-01-16T16:14:10-05:00",
  "id": "2073479000206587037", 
  "Created_By": {
    "name": "Troy Hutchinson",
    "id": "2073479000082155001"
  }
}

I'm puzzled why I'm still getting the error, as the response seems to contain a valid id.

Any help or suggestions would be greatly appreciated!

Thanks,