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
Saar MachtingerSaar Machtinger 

Invalid field AccountId for SObject Account - only for some profiles

I have written an VF page, to display return list of matched duplicate contacts before a lead convert.

While the process works for System Admin, some of my profiles, receive the following error - and are not getting the VF page to display:
Error: 
Invalid field AccountId for SObject Account
Error is in expression '{!item['AccountId']}' in component <apex:column> in page
leadconversionpage
Error evaluating dynamic reference 'AccountId'

The VF page, critical code is: leadConversionPage
<apex:sectionHeader title="Convert Lead" subtitle="{!oLead.Name}"/>
    <apex:form id="editPage">
        <apex:outputPanel rendered="{!hasDuplicateResult == false}">
            Leads can be converted to accounts, contacts, opportunities, and followup tasks.<br/>
            You should only convert a lead once you have identified it as qualified.<br/>
            After this lead has been converted, it can no longer be viewed or edited as a lead, but can be viewed in lead reports.<br/><br/>
        </apex:outputPanel>    
        <apex:outputPanel rendered="{!hasDuplicateResult}">
            To avoid creating duplicate contacts, select from the options below. When an existing contact is selected, all open activities from the lead will be added to the contact and all new data will be added. Lead data will not overwrite existing contact data.
        </apex:outputPanel> 
        
        
        <!-- saar added for duplicates -->
        <apex:pageBlock title="Duplicate Records" rendered="{!hasDuplicateResult}">
            <apex:pageMessages />
            <apex:pageBlockTable value="{!duplicateRecords}" var="item">
                <apex:column headerValue="Select to Merge">
                    <input type="radio" name="selectRadio" id="radio">
                    <apex:actionSupport event="onclick" action="{!setSelectedContactToMerge}" reRender="mergeButton">      
                        <apex:param name="selectedMergedContactId" value="{!item['Id']}"/>
                        <apex:param name="selectedMergedAccountId" value="{!item['AccountId']}"/>
                    </apex:actionSupport>
                </input>
            </apex:column>
            <apex:column >
                <apex:facet name="header">Name</apex:facet>
                <apex:outputLink value="/{!item['Id']}">{!item['Name']}</apex:outputLink>
            </apex:column>
            <apex:column >
                <apex:facet name="header">Owner</apex:facet>
                <apex:outputField value="{!item['OwnerId']}"/>
            </apex:column>                
            <apex:column >
                <apex:facet name="header">Account</apex:facet>
                <apex:outputField value="{!item['AccountId']}"/>
            </apex:column>
            <apex:column >
                <apex:facet name="header">Last Modified Date</apex:facet>
                <apex:outputField value="{!item['LastModifiedDate']}"/>
            </apex:column>
        </apex:pageBlockTable>
    </apex:pageBlock>


Any help appreciated.
 
devedeve
Hi Saar,

AccountId is not a field of account object. Its Contact object field. You are getting this error for Account object.
                                     Invalid field AccountId for SObject Account