Need Help figuring out this script

Need Help figuring out this script

I need help figuring out how to make this script work :

// Retrieve the Deal record
dealRecord = zoho.crm.getRecordById("Deals", input.deal_id);

// Get the values of the "Referred_By" field from the Deal record
referredByValues = dealRecord.get("Referred_By");
info referredByValues;

// Check if the "Referred_By" field is not empty
if (referredByValues != null && referredByValues.size() > 0) {
    // Create an empty array to store the contact IDs
    contactIds = List();
    info contactIds;
    
    // Iterate through the values of the "Referred_By" field
    for each referredByValue in referredByValues {
        // Get the ID value from each "Referred_By" field value
info referredByValue ;
        referredById = referredByValue.get("id").toLong();
        
        // Check if the ID value is not null
        if (referredById != null) {
            // Add the contact ID to the array
            contactIds.add(referredById);
        } else {
            // Output an error message if the ID value is null
            info "Invalid 'Referred_By' value found.";
        }
    }
    
    // Construct the search criteria string for retrieving Contact records
    searchCriteria = "id:(";
    for each contactId in contactIds {
        searchCriteria = searchCriteria + contactId + ",";
    }
    searchCriteria = searchCriteria.substring(0, searchCriteria.length() - 1) + ")";
    info searchCriteria;
    
    // Retrieve the Contact records associated with the contact IDs
    contactRecords = zoho.crm.searchRecords("Contacts", searchCriteria);
    info contactRecords;
    
    // Iterate through the contact records
    for each contactRecord in contactRecords {
        // Get the value of the "Commission_Referral" field from the Contact record
        commissionReferral = contactRecord.get("Commission_Referral");
        
        // Update the Deal record's "MTG_Referral_Fee" field with the value from "Commission_Referral"
        zoho.crm.updateRecord("Deals", input.deal_id, {"MTG_Referral_Fee": commissionReferral});
        
        // Output a success message
        info "The value from 'Commission_Referral' has been copied to 'MTG_Referral_Fee' successfully.";
    }
    
    // Output a message if no matching Contact records are found
    if (contactRecords == null || contactRecords.size() == 0) {
        info "No Contact records found with the provided 'Referred_By' values.";
    }
} else {
    // Output a message if the "Referred_By" field is empty
    info "The 'Referred_By' field in the Deal record is empty.";
}


So, I'm trying to get the value in the field : Commission_Referral in the contact module to copy the value into the field : MTG_Referral_Fee which is in the Deal Module. In the deal, i have a Multi-Select Lookup field called "Referred_By" that is link to the Contact Module, field: Deal_Referred. 

The error i get is : Failed to execute function
Data type of the argument of the function 'get' did not match the required data type of '[BIGINT]' Line Number:19

Can anyone tell me what i'm doing wrong ?