Can any one help me with Visual force page and coding? We need to replace standard Add product search layout and new search layout should have 5 picklist fields with AND condition.

Anyone helps really appreciated.

Thanks indvance.

  • Hi sai, this type of question isn't encouraged here and will likely be closed. If you make an honest effort and get stuck, we'll be more likely to help you. See How to Ask for more information. – sfdcfox Oct 12 '16 at 4:06

Yes sai @sfdcfox is right.

But I can give you an idea of how to approach this problem without going to code. 1. Create a visual force page and a controller with all the respective fields in place. 2. For a dynamic query, create a string and append the conditions to the string accordingly. 3. create a method that will be called on the click of the search button, in that method you can use the string and query that dynamically formed string.

| improve this answer | |
  • Hi @ sfdcfox , @ maruf , I agree with you , I tried and I got stuked . below is the code which tried – sai Oct 13 '16 at 0:29
  • I tried creating a VF Page with picklist fields from Product2 – sai Oct 13 '16 at 0:31
  • SELECT Id,Name,Productcode,family,CanUseQuantitySchedule,CanUseRevenueSchedule FROM Product2 WHERE Product2.Generation__c <> ' ' AND Product2.Inboard_Lite__c <> ' ' AND Product2.Laminate__c <> ' ' – sai Oct 13 '16 at 0:31
  • I was able to reach till I search but next step I need to give user product select with checkbox and When I search for product it is displaying all products instead it should display only with those picklist values selected . how to specify in my query only display selected picklist values . after selecting i should be able to naviagate to other page to add quantity , date and price – sai Oct 13 '16 at 0:42
  • One issue with this code is No products are getting displayed and I need add checkbox for product single and multi selection Please let me how to add checkbox before every product which is getting displayed after search and display selected products in next page – sai Oct 13 '16 at 1:08


    <apex:pageBlock title="Search Results" id="ResultsBlock">
        <apex:pageBlocksection columns="1">
        <apex:outputPanel id="out">
            <apex:pageBlockTable value="{!listclms}" var="clm" rendered="{!showResults}">
                <apex:column headerValue="Claim Name">
                    <apex:commandlink value="{!clm.Name}" action="/{!clm.id}"/>
                <apex:column value="{!clm.ProductCode}" headerValue="ProductCode"/>
               <!-- <apex:column value="{!clm.Description}" headerValue="Description"/> -->
                <apex:column value="{!clm.Family}" headerValue="Product Family"/>
                <apex:column value="{!clm.CanUseQuantitySchedule}" headerValue="Has Quantity Schedule"/>
                <apex:column value="{!clm.CanUseRevenueSchedule}" headerValue="Has Revenue Schedule"/>
            </apex:pageBlockTable> <br/>
            <apex:outputText rendered="{!showNoResults}" value="No Records Found" />


| improve this answer | |

public with sharing class ProductController_AC { // public Integer minAmt{get;set;} // public Integer maxAmt{get;set;} public list listclms{get;set;} public boolean showResults{get;set;} public boolean showNoResults{get;set;} public ProductController_AC(ApexPages.standardController objCtrl){ system.debug('### Constructor running'); listclms = new list(); showResults=false; showNoResults=false;

} public void searchButtonClicked(){ try{ listclms = [SELECT Id,Name,Productcode,family,CanUseQuantitySchedule,CanUseRevenueSchedule FROM Product2 WHERE Generation__c <> null AND Inboard_Lite__c =: null AND Laminate__c <> null ]; if(listclms.size()>0){ showResults=true; showNoResults=false; } else{ showResults=false; showNoResults=true; system.debug('Please check'); // return listclms.errorMessage('Select all picklist values');

       //ClaimController_AC.showmessage('Please redefine your search criteria');
     system.debug('### listAccs.size: '+listclms.size());
  catch(Exception objException){
     system.debug('### objException: '+objException.getMessage());

public void clearButtonClicked(){ showResults=false; showNoResults=false; listclms = new list();

} }

| improve this answer | |

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.