Function/Deluge error data type - Script to Assign Contacts to Accounts Based on Domain

Function/Deluge error data type - Script to Assign Contacts to Accounts Based on Domain

Hi,
we have hundres of contacts without any assigned company (account). Now we're adding companies and have a field called "domain" where we have the domain.tld (it's cleaned up via another function).

Now I have the following script to search for UNassigned contacts with the same domain. But I'll get the following error in the editor:

Data type of the argument of the function 'get' did not match the required data type of '[BIGINT]' Line Number:20

// Parameter: account_id (ID of the updated account)

// Get the details of the account
account_id = input.account_id.toString(); // Handle the ID as a string
account_details = zoho.crm.getRecordById("Accounts", account_id);

// Get the domain of the account
domain = account_details.get("Domain");

if(domain != null && domain != "")
{
    // Search for contacts whose email address contains the same domain and are not assigned to any account
    search_criteria = "(Email:contains:" + domain + ") and (Account_Name is null)";
    contacts = zoho.crm.searchRecords("Contacts", search_criteria);
    
    if(contacts.size() > 0)
    {
        // Loop through the found contacts and assign them to the account
        for each contact in contacts
        {
            contact_id = contact.get("id").toString(); // Handle the contact ID as a string
            update_map = map();
            update_map.put("Account_Name", account_id);
            update_response = zoho.crm.updateRecord("Contacts", contact_id, update_map);

            if(update_response.get("code") != "SUCCESS")
            {
                // Error handling
                info "Error assigning contact with ID: " + contact_id + " to account ID: " + account_id + ". Error: " + update_response.get("message");
            }
            else
            {
                info "Successfully assigned contact with ID: " + contact_id + " to account ID: " + account_id + ".";
            }
        }
    }
    else
    {
        info "No contacts found with the domain " + domain + " in the email address that are not assigned to any account.";
    }
}
else
{
    info "No valid domain for account ID: " + account_id;
}