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
Guillaume MendlevitchGuillaume Mendlevitch 

Not all data returned - VisualForce and Apex Controller

Hello,

Here is a simple query in Apex:
 
public class edf {

    public list <Asset__c> accaccount {get;set;}
    public String researchKey {get;set;}
 
    public edf( ) {
    }
    
    public void research(){

        researchKey='a1H200000006MCoEAM';
        String searchqueryaccount;
        String Idie='00120000013UXzOAAW';
        
        searchqueryaccount='SELECT Id, Account__r.Name FROM Asset__c WHERE (Asset__c.Product_Strategy__r.Product_ID_18__c LIKE \'%'+researchKey+'%\' AND Account__r.Account_ID_18__c LIKE \'%'+Idie+'%\')';
        
        accaccount= Database.query(searchqueryaccount);
        
    }
    }



And here is the VisualForce code:
 
<apex:page Controller="edf" action="{!research}"> 
    
    <apex:form >

        <apex:pageBlock title="Assets">
            
            <apex:repeat value="{!accaccount}" var="a">
                
                {!a.Id}

            </apex:repeat>
            
        </apex:pageBlock>
     
    </apex:form>
    </apex:page>



It is supposed to simply return Asset IDs for a certain Product ID and a certain Account ID.

The problem is: it does return 10 results whereas I get 32 results with the same SOQL query in Workbench Salesforce.

Could you please help me understand what is wrong with my code? It should be returning 32 results as well.

 
edanna kedanna k
Hello Guillaume Mendlevitch,

I dont see any wrong with your code!
Even i have tried in my Dev org with account object with similar logic as you. Records from soql workbench and soql inside VF are matched.

Please refer https://salesforce.stackexchange.com/questions/42292/weird-missing-record-issue-with-soql-query?rq=1.
it might help you!

Regards,
Edanna.
    (Loving Problems!)
Christian Schwabe (x)Christian Schwabe (x)
Perhaps you have not the right permission to the see / query all those records?
Sencond I think about the context in which the vf-page is called. Eventually the vf-page is viewed / called in another context than your query?