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
Esther Thacker 6Esther Thacker 6 

CountryCode Error Listview

I created a Listview that shows Country and State/Providence as fields on the view. When I go to do a MassEdit it gives this error:

core.apexpages.exceptions.ApexPagesHandledException: Object type not accessible. Please check permissions and make sure the object is not in development mode: (IsConverted = FALSE)) ) ORDER BY CountryCode ASC LIMIT 10000 ^ ERROR at Row:2:Column:39 No such column 'CountryCode' on entity 'Lead'. If you are attempting to use a custom field, be sure to append the '__c' after the custom field name. Please reference your WSDL or the describe call for the appropriate names.. Original queryString was: 'SELECT Id, City, Street, State, PostalCode, Country, Company, Corporate_Name__c, Description, Email, Franchise__c, Industry, International_Contact__c, Is_your_company_a_Franchise__c, Name, Salutation, FirstName, LastName, Number_of_Units__c, NumberOfEmployees, Phone, Status, Verticial__c, Website FROM Lead WHERE ( ((OwnerId = '005E0000007aJhC') and (IsConverted = FALSE)) ) ORDER BY CountryCode ASC LIMIT 10000' 

The problem seems to rest with the fact that I have Country and State/Providence in the listview. There is a text only version of each of those fields and when I use those instead I am able to do a mass edit. So I am guessing the problem is with those specific type of fields. I have State and Country/Territory Picklists enabled. If I can use the text only version it's not really an issue, but I would like to know why that version of the field is not working but the other one is. (In case an issue related to this pops up later and there is a resolve for it).


Hi Esther,

I don't think CountryCode is a valid field on Lead.
Esther Thacker 6Esther Thacker 6
That's what it's saying, but Country is in the address part of the lead, and the text only version works just fine which is calling the same information. 
I guess you have some custom logic which runs when you click the Mass Edit, we might need to check that code.
Esther Thacker 6Esther Thacker 6
The only thing I changed to the Visualforce page of the MassEditLead was adding in fields that could be mass edited.

Here is the code just in case:

<apex:page standardController="Lead" recordSetVar="unused" sidebar="false">
<apex:includeScript value="{!$Resource.UtilJS}" />
<apex:form >
<apex:pageBlock >
<apex:pageMessages />
<apex:pageBlock > Note: All modifications made on the page will be lost if Return button is clicked without clicking the Save button first. </apex:pageBlock>
<apex:pageBlockButtons >
<apex:commandButton value="Save" action="{!save}"/>
<apex:commandButton value="Return" action="{!cancel}"/>
/apex:pageBlockButtons> <apex:pageBlockTable value="{!selected}" var="a" id="table">
<apex:column headerValue="Name">
<apex:inputField value="{!a.Name}"/>
<apex:column headerValue="Description">
<apex:inputField value="{!a.Description}"/>
<apex:column headerValue="Email">
<apex:inputField value="{!a.Email}"/>
<apex:column headerValue="Phone">
<apex:inputField value="{!a.Phone}"/>
<apex:column headerValue="Status">
<apex:inputField value="{!a.Status}"/>
<apex:column headerValue="Company">
<apex:inputField value="{!a.Company}"/>
<apex:column headerValue="Corporate Name">
<apex:inputField value="{!a.Corporate_Name__c}"/>
<apex:column headerValue="Country">
<apex:inputField value="{!a.Country}"/>
apex:column headerValue="Street">
<apex:inputField value="{!a.Street}"/>
<apex:column headerValue="City">
<apex:inputField value="{!a.City}"/>
<apex:column headerValue="State/Province">
<apex:inputField value="{!a.State}"/>
<apex:column headerValue="Zip/Postal Code">
apex:inputField value="{!a.PostalCode}"/>
<apex:column headerValue="Industry">
<apex:inputField value="{!a.Industry}"/>
<apex:column headerValue="Industry Vertical">
<apex:inputField value="{!a.Verticial__c}"/>
<apex:column headerValue="#Units">
<apex:inputField value="{!a.Number_of_Units__c}"/>
<apex:column headerValue="#Employees">
<apex:inputField value="{!a.NumberOfEmployees}"/>
<apex:column headerValue="Is Your Company a Franchise?">
<apex:inputField value="{!a.Is_your_company_a_Franchise__c}"/>
<apex:column headerValue="Multi-Unit">
<apex:inputField value="{!a.Franchise__c}"/>
<apex:column headerValue="International Contact?">
<apex:inputField value="{!a.International_Contact__c}"/>
</apex:column> <apex:column headerValue="Website">
<apex:inputField value="{!a.Website}"/>

The visualforce page displays fine and edits the fields, because we have been using it since I added in the extra fields that weren't standard witht he MassEditLead visualforce page, but when we added in the fields Country and State/Province on the ListView that is when we got the error. We wanted to be able to mass edit the addresses for the Leads, but adding in Address doesn't work, so I had to do each individual one. They display and edit the fields just fine, it's just when those fields are first present in the List View that it gives that error.