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.
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.
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.
<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>
<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" />
</apex:outputPanel>
</apex:pageBlocksection>
</apex:pageBlock>
</apex:form>
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();
} }