• Nico Anica
  • NEWBIE
  • 10 Points
  • Member since 2019

  • Chatter
    Feed
  • 0
    Best Answers
  • 0
    Likes Received
  • 0
    Likes Given
  • 1
    Questions
  • 1
    Replies
Hello, 
I am trying to display some information but everytime I have this following message error :
SObject row was retrieved via SOQL without querying the requested field: Contact.Client_a_risque__c

Here below is my code : 

<!--*********************************************************************************
Class Name      : CCF_CustomContactSearch
Description     : This page will be open by InIn on an Agent's browser, once a Case is 
                  assigned to the Agent. 
                  When loaded, the page will contain a list of Contacts 
                  possibly matching to a value (svalue) contained in the URL as a parameter
                  The Agent also has the option to search for a specific contact, using the
                  input field beside "Search Contact" button. The value provided in the input 
                  field will be searched in ALL fields in the Contact Object
                  For every listed Contact, the Agent has the option lo link it to the Case,
                  using "Link to Case" button
Created By      : Mihai JURIAN
Created Date    : 30-Jan-17
Modification Log:
================================================================================== 
Developer                   Date                   Description
==================================================================================        
Mihai Jurian            30-Jan-17                   Initial Version
*********************************************************************************-->
<apex:page controller="CCF_searchContactController" docType="html-5.0" action="{!search_onLoad}" title="{!$Label.InIn_Recherche_de_contact}">

    <apex:includeScript value="/support/console/28.0/integration.js"/>
    <script type="text/javascript">
        function openCaseDetails() {
            sforce.console.openPrimaryTab(undefined, '/{!caseId}', true, '{!caseNumber}');
            closeTab();
        }

        // The callback function that closeTab will call once it has the ID for its tab
        var callCloseTab = function callCloseTab(result) {
            sforce.console.closeTab(result.id);
        }
    
        function closeTab() {
            sforce.console.getEnclosingPrimaryTabId(callCloseTab);
        }
    
        var pageLoad = window.onload;
        window.onload = function() 
        {
            if (pageLoad) 
            {
                pageLoad();
            }
            sforce.console.setTabTitle('{!$Label.InIn_Recherche_de_contact}');
        }
    </script>
    <apex:form >
        <apex:actionFunction name="updateSortOrderBy1" action="{!updateSortOrderBy}">
            <apex:param id="updateOrderBy" name="updateOrderBy" value="" />
        </apex:actionFunction>
        <apex:actionFunction name="search_method" action="{!search_method}" />

        
        <apex:input value="{!searchValue}" id="searchValue"/>
        <apex:commandButton value="{!$Label.InIn_Trouver_le_Contact}" onclick="search_method(); return false;" />
        <apex:outputText id="searchWarning" value="Please enter at least 2 characters before searching." rendered="{!showSearchWarning}" />
        
       
        <apex:pageBlock title="Contacts" id="block">
            <apex:inputCheckbox value="{!excludeHasFilter}"  onclick="search_method();" />
            <apex:outputText >{!$Label.CCF_CustomSearch_IncludeAllRecords}</apex:outputText>
            <br/>&nbsp;
            <apex:pageMessages />
            <!-- the Pagination/Navigation buttons -->
            <apex:pageBlockButtons rendered="{!RenderNavigation}" location="bottom"> 
                <apex:commandButton value="{!$Label.navigationFirst}" action="{!first}" disabled="{!DisablePrevious}"/>
                <apex:commandButton value="{!$Label.navigationPrevious}" action="{!previous}" disabled="{!DisablePrevious}"/>
                <apex:commandButton value="{!$Label.navigationNext}" action="{!next}" disabled="{!DisableNext}"/>
                <apex:commandButton value="{!$Label.navigationLast}" action="{!last}" disabled="{!DisableNext}"/>
            </apex:pageBlockButtons>
            <!-- the table showing the Contacts -->
            <apex:pageblockTable id="contactList" value="{!conListToShow}" var="con">
                <apex:column >
                    <apex:facet name="header">
                        <apex:commandLink action="{!updateSortOrderBy}" value="{!$ObjectType.Contact.fields.Name.Label + IF(orderBy == 'Name', '▼', IF(orderBy == 'Name DESC', '▲', ''))}" >
                            <apex:param name="updateOrderBy" value="Name" assignTo="{!updateOrderBy}"/>
                        </apex:commandLink>
                    </apex:facet>
                    <apex:outputLink value="/{!con.Id}" id="theLink">{!con.name}</apex:outputLink>
                </apex:column>
                <apex:column >
                    <apex:facet name="header">
                        <apex:commandLink action="{!updateSortOrderBy}" value="{!$ObjectType.Contact.fields.Birthdate.Label + IF(orderBy == 'Birthdate', '▼', IF(orderBy == 'Birthdate DESC', '▲', ''))}" >
                            <apex:param name="updateOrderBy" value="Birthdate" assignTo="{!updateOrderBy}"/>
                        </apex:commandLink>
                    </apex:facet>
                    <apex:outputfield value="{!con.Birthdate}"/>
                </apex:column>
                <apex:column >
                    <apex:facet name="header">
                        <apex:commandLink action="{!updateSortOrderBy}" value="{!$ObjectType.Contact.fields.Phone_1__c.Label + IF(orderBy == 'Phone_1__c', '▼', IF(orderBy == 'Phone_1__c DESC', '▲', ''))}" >
                            <apex:param name="updateOrderBy" value="Phone_1__c" assignTo="{!updateOrderBy}"/>
                        </apex:commandLink>
                    </apex:facet>
                    <apex:outputfield value="{!con.Phone_1__c}"/>
                </apex:column>
                <apex:column >
                    <apex:facet name="header">
                        <apex:commandLink action="{!updateSortOrderBy}" value="{!$ObjectType.Contact.fields.Phone_2__c.Label + IF(orderBy == 'Phone_2__c', '▼', IF(orderBy == 'Phone_2__c DESC', '▲', ''))}" >
                            <apex:param name="updateOrderBy" value="Phone_2__c" assignTo="{!updateOrderBy}"/>
                        </apex:commandLink>
                    </apex:facet>
                    <apex:outputfield value="{!con.Phone_2__c}"/>
                </apex:column>
                <apex:column >
                    <apex:facet name="header">
                        <apex:commandLink action="{!updateSortOrderBy}" value="{!$ObjectType.Contact.fields.Phone_3__c.Label + IF(orderBy == 'Phone_3__c', '▼', IF(orderBy == 'Phone_3__c DESC', '▲', ''))}" >
                            <apex:param name="updateOrderBy" value="Phone_3__c" assignTo="{!updateOrderBy}"/>
                        </apex:commandLink>
                    </apex:facet>
                    <apex:outputfield value="{!con.Phone_3__c}"/>
                </apex:column>
                <apex:column >
                    <apex:facet name="header">
                        <apex:commandLink action="{!updateSortOrderBy}" value="{!$ObjectType.Contact.fields.Email_1__c.Label + IF(orderBy == 'Email_1__c', '▼', IF(orderBy == 'Email_1__c DESC', '▲', ''))}" >
                            <apex:param name="updateOrderBy" value="Email_1__c" assignTo="{!updateOrderBy}"/>
                        </apex:commandLink>
                    </apex:facet>
                    <apex:outputfield value="{!con.Email_1__c}"/>
                </apex:column>
                <apex:column >
                    <apex:facet name="header">
                        <apex:commandLink action="{!updateSortOrderBy}" value="{!$ObjectType.Contact.fields.Email_2__c.Label + IF(orderBy == 'Email_2__c', '▼', IF(orderBy == 'Email_2__c DESC', '▲', ''))}" >
                            <apex:param name="updateOrderBy" value="Email_2__c" assignTo="{!updateOrderBy}"/>
                        </apex:commandLink>
                    </apex:facet>
                    <apex:outputfield value="{!con.Email_2__c}"/>
                </apex:column>
                <apex:column >
                    <apex:facet name="header">
                        <apex:commandLink action="{!updateSortOrderBy}" value="{!$ObjectType.Contact.fields.Agency_PIN__c.Label + IF(orderBy == 'Agency_PIN__c', '▼', IF(orderBy == 'Agency_PIN__c DESC', '▲', ''))}" >
                            <apex:param name="updateOrderBy" value="Agency_PIN__c" assignTo="{!updateOrderBy}"/>
                        </apex:commandLink>
                    </apex:facet>
                    <apex:outputfield value="{!con.Agency_PIN__c}"/>
                </apex:column>
                <apex:column >
                    <apex:facet name="header">
                        <apex:commandLink action="{!updateSortOrderBy}" value="{!'Record Type' + IF(orderBy == 'RecordType.Name', '▼', IF(orderBy == 'RecordType.Name DESC', '▲', ''))}" >
                            <apex:param name="updateOrderBy" value="RecordType.Name" assignTo="{!updateOrderBy}"/>
                        </apex:commandLink>
                    </apex:facet>
                    <apex:outputfield value="{!con.RecordType.Name}"/>
                </apex:column>
                <apex:column >
                    <apex:facet name="header">
                        <apex:commandLink action="{!updateSortOrderBy}" value="{!$ObjectType.Contact.fields.Client_a_risque__c.Label + IF(orderBy == 'Client_a_risque__c', '▼', IF(orderBy == 'Client_a_risque__c DESC', '▲', ''))}" >
                            <apex:param name="updateOrderBy" value="Client_a_risque__c" assignTo="{!updateOrderBy}"/>
                        </apex:commandLink>
                    </apex:facet>
                    <apex:outputfield value="{!con.Client_a_risque__c}"/>
                </apex:column>
                <!-- the buttons "Link to Case" -->
                <apex:column headervalue="{!$Label.Link_to_Case}">
                    <apex:commandButton value="{!$Label.Link_to_Case}" action="{!linkContactToCase}" rerender="block" oncomplete="openCaseDetails()">
                        <apex:param name="theContactId" value="{!con.Id}" assignTo="{!contactId}"/>
                    </apex:commandButton>
                </apex:column>
            </apex:pageblockTable>
        </apex:pageBlock>
    </apex:form>
</apex:page>


THANK YOU VERY MUCH FOR YOUR HELP.
Hello, 
I am trying to display some information but everytime I have this following message error :
SObject row was retrieved via SOQL without querying the requested field: Contact.Client_a_risque__c

Here below is my code : 

<!--*********************************************************************************
Class Name      : CCF_CustomContactSearch
Description     : This page will be open by InIn on an Agent's browser, once a Case is 
                  assigned to the Agent. 
                  When loaded, the page will contain a list of Contacts 
                  possibly matching to a value (svalue) contained in the URL as a parameter
                  The Agent also has the option to search for a specific contact, using the
                  input field beside "Search Contact" button. The value provided in the input 
                  field will be searched in ALL fields in the Contact Object
                  For every listed Contact, the Agent has the option lo link it to the Case,
                  using "Link to Case" button
Created By      : Mihai JURIAN
Created Date    : 30-Jan-17
Modification Log:
================================================================================== 
Developer                   Date                   Description
==================================================================================        
Mihai Jurian            30-Jan-17                   Initial Version
*********************************************************************************-->
<apex:page controller="CCF_searchContactController" docType="html-5.0" action="{!search_onLoad}" title="{!$Label.InIn_Recherche_de_contact}">

    <apex:includeScript value="/support/console/28.0/integration.js"/>
    <script type="text/javascript">
        function openCaseDetails() {
            sforce.console.openPrimaryTab(undefined, '/{!caseId}', true, '{!caseNumber}');
            closeTab();
        }

        // The callback function that closeTab will call once it has the ID for its tab
        var callCloseTab = function callCloseTab(result) {
            sforce.console.closeTab(result.id);
        }
    
        function closeTab() {
            sforce.console.getEnclosingPrimaryTabId(callCloseTab);
        }
    
        var pageLoad = window.onload;
        window.onload = function() 
        {
            if (pageLoad) 
            {
                pageLoad();
            }
            sforce.console.setTabTitle('{!$Label.InIn_Recherche_de_contact}');
        }
    </script>
    <apex:form >
        <apex:actionFunction name="updateSortOrderBy1" action="{!updateSortOrderBy}">
            <apex:param id="updateOrderBy" name="updateOrderBy" value="" />
        </apex:actionFunction>
        <apex:actionFunction name="search_method" action="{!search_method}" />

        
        <apex:input value="{!searchValue}" id="searchValue"/>
        <apex:commandButton value="{!$Label.InIn_Trouver_le_Contact}" onclick="search_method(); return false;" />
        <apex:outputText id="searchWarning" value="Please enter at least 2 characters before searching." rendered="{!showSearchWarning}" />
        
       
        <apex:pageBlock title="Contacts" id="block">
            <apex:inputCheckbox value="{!excludeHasFilter}"  onclick="search_method();" />
            <apex:outputText >{!$Label.CCF_CustomSearch_IncludeAllRecords}</apex:outputText>
            <br/>&nbsp;
            <apex:pageMessages />
            <!-- the Pagination/Navigation buttons -->
            <apex:pageBlockButtons rendered="{!RenderNavigation}" location="bottom"> 
                <apex:commandButton value="{!$Label.navigationFirst}" action="{!first}" disabled="{!DisablePrevious}"/>
                <apex:commandButton value="{!$Label.navigationPrevious}" action="{!previous}" disabled="{!DisablePrevious}"/>
                <apex:commandButton value="{!$Label.navigationNext}" action="{!next}" disabled="{!DisableNext}"/>
                <apex:commandButton value="{!$Label.navigationLast}" action="{!last}" disabled="{!DisableNext}"/>
            </apex:pageBlockButtons>
            <!-- the table showing the Contacts -->
            <apex:pageblockTable id="contactList" value="{!conListToShow}" var="con">
                <apex:column >
                    <apex:facet name="header">
                        <apex:commandLink action="{!updateSortOrderBy}" value="{!$ObjectType.Contact.fields.Name.Label + IF(orderBy == 'Name', '▼', IF(orderBy == 'Name DESC', '▲', ''))}" >
                            <apex:param name="updateOrderBy" value="Name" assignTo="{!updateOrderBy}"/>
                        </apex:commandLink>
                    </apex:facet>
                    <apex:outputLink value="/{!con.Id}" id="theLink">{!con.name}</apex:outputLink>
                </apex:column>
                <apex:column >
                    <apex:facet name="header">
                        <apex:commandLink action="{!updateSortOrderBy}" value="{!$ObjectType.Contact.fields.Birthdate.Label + IF(orderBy == 'Birthdate', '▼', IF(orderBy == 'Birthdate DESC', '▲', ''))}" >
                            <apex:param name="updateOrderBy" value="Birthdate" assignTo="{!updateOrderBy}"/>
                        </apex:commandLink>
                    </apex:facet>
                    <apex:outputfield value="{!con.Birthdate}"/>
                </apex:column>
                <apex:column >
                    <apex:facet name="header">
                        <apex:commandLink action="{!updateSortOrderBy}" value="{!$ObjectType.Contact.fields.Phone_1__c.Label + IF(orderBy == 'Phone_1__c', '▼', IF(orderBy == 'Phone_1__c DESC', '▲', ''))}" >
                            <apex:param name="updateOrderBy" value="Phone_1__c" assignTo="{!updateOrderBy}"/>
                        </apex:commandLink>
                    </apex:facet>
                    <apex:outputfield value="{!con.Phone_1__c}"/>
                </apex:column>
                <apex:column >
                    <apex:facet name="header">
                        <apex:commandLink action="{!updateSortOrderBy}" value="{!$ObjectType.Contact.fields.Phone_2__c.Label + IF(orderBy == 'Phone_2__c', '▼', IF(orderBy == 'Phone_2__c DESC', '▲', ''))}" >
                            <apex:param name="updateOrderBy" value="Phone_2__c" assignTo="{!updateOrderBy}"/>
                        </apex:commandLink>
                    </apex:facet>
                    <apex:outputfield value="{!con.Phone_2__c}"/>
                </apex:column>
                <apex:column >
                    <apex:facet name="header">
                        <apex:commandLink action="{!updateSortOrderBy}" value="{!$ObjectType.Contact.fields.Phone_3__c.Label + IF(orderBy == 'Phone_3__c', '▼', IF(orderBy == 'Phone_3__c DESC', '▲', ''))}" >
                            <apex:param name="updateOrderBy" value="Phone_3__c" assignTo="{!updateOrderBy}"/>
                        </apex:commandLink>
                    </apex:facet>
                    <apex:outputfield value="{!con.Phone_3__c}"/>
                </apex:column>
                <apex:column >
                    <apex:facet name="header">
                        <apex:commandLink action="{!updateSortOrderBy}" value="{!$ObjectType.Contact.fields.Email_1__c.Label + IF(orderBy == 'Email_1__c', '▼', IF(orderBy == 'Email_1__c DESC', '▲', ''))}" >
                            <apex:param name="updateOrderBy" value="Email_1__c" assignTo="{!updateOrderBy}"/>
                        </apex:commandLink>
                    </apex:facet>
                    <apex:outputfield value="{!con.Email_1__c}"/>
                </apex:column>
                <apex:column >
                    <apex:facet name="header">
                        <apex:commandLink action="{!updateSortOrderBy}" value="{!$ObjectType.Contact.fields.Email_2__c.Label + IF(orderBy == 'Email_2__c', '▼', IF(orderBy == 'Email_2__c DESC', '▲', ''))}" >
                            <apex:param name="updateOrderBy" value="Email_2__c" assignTo="{!updateOrderBy}"/>
                        </apex:commandLink>
                    </apex:facet>
                    <apex:outputfield value="{!con.Email_2__c}"/>
                </apex:column>
                <apex:column >
                    <apex:facet name="header">
                        <apex:commandLink action="{!updateSortOrderBy}" value="{!$ObjectType.Contact.fields.Agency_PIN__c.Label + IF(orderBy == 'Agency_PIN__c', '▼', IF(orderBy == 'Agency_PIN__c DESC', '▲', ''))}" >
                            <apex:param name="updateOrderBy" value="Agency_PIN__c" assignTo="{!updateOrderBy}"/>
                        </apex:commandLink>
                    </apex:facet>
                    <apex:outputfield value="{!con.Agency_PIN__c}"/>
                </apex:column>
                <apex:column >
                    <apex:facet name="header">
                        <apex:commandLink action="{!updateSortOrderBy}" value="{!'Record Type' + IF(orderBy == 'RecordType.Name', '▼', IF(orderBy == 'RecordType.Name DESC', '▲', ''))}" >
                            <apex:param name="updateOrderBy" value="RecordType.Name" assignTo="{!updateOrderBy}"/>
                        </apex:commandLink>
                    </apex:facet>
                    <apex:outputfield value="{!con.RecordType.Name}"/>
                </apex:column>
                <apex:column >
                    <apex:facet name="header">
                        <apex:commandLink action="{!updateSortOrderBy}" value="{!$ObjectType.Contact.fields.Client_a_risque__c.Label + IF(orderBy == 'Client_a_risque__c', '▼', IF(orderBy == 'Client_a_risque__c DESC', '▲', ''))}" >
                            <apex:param name="updateOrderBy" value="Client_a_risque__c" assignTo="{!updateOrderBy}"/>
                        </apex:commandLink>
                    </apex:facet>
                    <apex:outputfield value="{!con.Client_a_risque__c}"/>
                </apex:column>
                <!-- the buttons "Link to Case" -->
                <apex:column headervalue="{!$Label.Link_to_Case}">
                    <apex:commandButton value="{!$Label.Link_to_Case}" action="{!linkContactToCase}" rerender="block" oncomplete="openCaseDetails()">
                        <apex:param name="theContactId" value="{!con.Id}" assignTo="{!contactId}"/>
                    </apex:commandButton>
                </apex:column>
            </apex:pageblockTable>
        </apex:pageBlock>
    </apex:form>
</apex:page>


THANK YOU VERY MUCH FOR YOUR HELP.