function readOnly(count){ }
Starting November 20, the site will be set to read-only. On December 4, 2023,
forum discussions will move to the Trailblazer Community.
+ Start a Discussion

Invalid bind expression type of Object for column of type ID

Hey everybody!

I'm trying to write my first wrapper class whic will allow me to create records related to both a custom object (Site__c) and the Quote object. What I am having an issue with is passing the QuoteId to the SOQL query on line 11. I have tried it with a hardcoded QuoteId and it works correctly. Right now when I try and save it gives me the error 'Invalid bind expression type of Object for column of type Id'. 

What is the issue here? Is it because of the standard controller is my other custom object (Associated_Location__c)? Thanks in advance! 

public with sharing class quoteAssociatedSiteExtension {

	//Our collection of the class/wrapper objects cContact 
	public Quote theQuote {get; set;}
    public List<assLoc> assLocList {get; set;}
    public quoteAssociatedSiteExtension(ApexPages.StandardController controller) { 

        controller.addFields(new List<String>{'Quote__c'});
		theQuote = [select Id, AccountId from Quote where Id =:controller.getRecord().get('Quote__c') limit 1];

	//This method uses a simple SOQL query to return a List of Contacts
	public List<assLoc> getAssLoc() {
		if(assLocList == null) {
			assLocList = new List<assLoc>();
			for(Site__c s: [select Id, Name, Account__r.Id from Site__c where Account__r.Id=:theQuote.AccountId limit 10]) {
				// As each contact is processed we create a new cContact object and add it to the contactList
				assLocList.add(new assLoc(s));
		return assLocList;

	public PageReference processSelected() {

                //We create a new list of Contacts that we be populated only with Contacts if they are selected
		List<Associated_Location__c> selectedAssociatedLocations = new List<Associated_Location__c>();

		//We will cycle through our list of cContacts and will check to see if the selected property is set to true, if it is we add the Contact to the selectedContacts list
		for(assLoc aLoc: getAssLoc()) {
			if(aLoc.selected == true) {

		// Now we have our list of selected contacts and can perform any type of logic we want, sending emails, updating a field on the Contact, etc
		System.debug('These are the selected Contacts...');
		for(Associated_Location__c ac: selectedAssociatedLocations) {
		assLocList=null; // we need this line if we performed a write operation  because getContacts gets a fresh list now
		return null;

	// This is our wrapper/container class. A container class is a class, a data structure, or an abstract data type whose instances are collections of other objects. In this example a wrapper class contains both the standard salesforce object Contact and a Boolean value
	public class assLoc {
		public Associated_Location__c ac {get; set;}
        public Site__c st {get; set;}
        public Quote qt {get; set;}
		public Boolean selected {get; set;}

		//This is the contructor method. When we create a new cContact object we pass a Contact that is set to the con property. We also set the selected value to false
		public assLoc(Associated_Location__c a) {
			ac = a;
			selected = false;
        public assLoc(Site__c s) {
			st = s;
			selected = false;
		public assLoc(Quote q) {
			qt = q;
			selected = false;

<apex:page standardController="Associated_Location__c" extensions="quoteAssociatedSiteExtension">
    <apex:form >
        <apex:pageBlock >
            <apex:pageBlockButtons >
                <apex:commandButton value="Process Selected" action="{!processSelected}" rerender="table"/>
            <!-- In our table we are displaying the cContact records -->
            <apex:pageBlockTable value="{!AssLoc}" var="a" id="table">
                <apex:column >
                    <!-- This is our selected Boolean property in our wrapper class -->
                    <apex:inputCheckbox value="{!a.selected}"/>
                <!-- This is how we access the contact values within our cContact container/wrapper -->
                <apex:column value="{!}" />

Hi Will,
this is because the ":controller.getRecord().get('Quote__c')" expression gives you out an "Object" type. 
I suggest you use ":controller.getId()" or ":(ID)controller.getRecord().get('Quote__c')": this should resolve your issue!
Happy coding!!

May the be with you!!