• Lahari Kondadi
  • NEWBIE
  • 30 Points
  • Member since 2015

  • Chatter
    Feed
  • 0
    Best Answers
  • 0
    Likes Received
  • 0
    Likes Given
  • 6
    Questions
  • 6
    Replies
Hi experts,
I have a requirement where i need to highlight the new records which were entered in previous week in a custom report that will be rendered as a pdf.....what logic i need too use here to highlight the new records entered in previous week...please help.

Thanks,
Lahari
Hi experts,
I have a requirement where the user should be able to include the records where the due date is not populated when i check the checkbox field in the vf page.In my case that date field is named as Due_Date__c.
I have written the follwing dynamic soql code.But it is not fetching the records where the due date is not populated.Please help
 
public class PrivateEquityReport
{
   ApexPages.StandardSetController regionStandardSetController{get;set;}
   private Id privateRecordTypeId = Fund_Activity__c.SObjectType.getDescribe().getRecordTypeInfosByName().get(' Amendment').getRecordTypeId();
   public AI_PrivateEquityWeeklyTrackingReport()
   String baseQuery = 'SELECT Id,Due_Date__c,Fund__r.Name,Company__r.Name,Subject__c,Comments__c,Date_Received__c,Business_Review__c,Attorney_Review__c FROM Fund__c WHERE Team__c=\'Equity\' AND RecordTypeId =:privateRecordTypeId';

   public PrivateEquityReport()
  {
    regionStandardSetController=new ApexPages.StandardSetController(new  list<Fund__c>());
    String dueDateCheck=System.currentPageReference().getParameters().get('DueDateCheck');
    if(dueDateCheck=='true')
      isDueDate=true; 
   else
      isDueDate=false;
  }

public String  getReportText()
{
    String checkQuery = baseQuery;

     String reportFromDateVar = System.currentPageReference().getParameters().get('dFromDate');
     Date fromDateVar = null;
    if(reportFromDateVar != null)
    fromDateVar = Date.valueOf(reportFromDateVar);
    System.debug('*****From Date***'+fromDateVar );

     String reportToDateVar = System.currentPageReference().getParameters().get('dToDate');
     Date toDateVar = null;
    if(reportToDateVar != null)
    toDateVar = Date.valueOf(reportToDateVar );
     System.debug('*****To Date***'+toDateVar );

     if((fromDateVar!= null)&&(toDateVar!=null)&&(!isDueDate))
    {
      checkQuery =checkQuery +' '+'and (Due_Date__c>=:fromDateVar AND Due_Date__c<= :toDateVar)';
      checkQuery =checkQuery +' '+'and Due_Date__c=NULL';
      system.debug('************3'+checkQuery);
    }

    regionStandardSetController=new ApexPages.StandardSetController(Database.getQueryLocator(checkQuery));
    activityRecords= regionStandardSetController.getRecords();
     displayPrivateEquity ='<table><tr><td>&nbsp;</td></tr><tr><td>&nbsp;</td></tr></table>' + displayPrivateEquity ;                
     displayPrivateEquity = prepareReportSinglePagePrivateEquity(activityRecords,displayPrivateEquity );
     return  displayPrivateEquity; 
}
Thanks,
Lahari
 
Hi experts,
               I have a requirement where the page should work in both all desktop based browsers and apple ipad. The page which i have created is working in all desktop based browsers.But its not working properly in ipad. The calendar is giving problem in ipad.

Below is the snapshot when io run my page in desktop browser.

User-added image

Below is the screenshot when i run in one/one.app selecting apple ipad. I have encircled the calendar part which is appearing before clicking on From or To input fields in the snapshot.The calendar should appear when i click on From date near that field itself.

User-added image

Below is the visualforce code and apex code which i have written.

Visualforce
 
<apex:page Controller="GVWS_GenerateReport" docType="html-5.0">


<apex:sectionHeader title="Reports" subtitle="Generate Report" id="sectionHeaderId"/>

 <apex:form id="ReportRegion">
  <apex:outputPanel id="msgPanel">
        <apex:pageMessages ></apex:pageMessages>
    </apex:outputPanel>
    <apex:pageblock id="pb">
    
        <apex:pageBlockSection id="SearchPanel" showHeader="true" columns="1">
           <!-- <apex:outputLabel value="Region"/>-->
           
            <apex:inputtext label="Region" id="rname" value="{!region}"/>
           <!-- <apex:outputLabel value="Country"/>
           <apex:outputLabel value="Close Date:">-->
              <apex:outputLabel style="color:#666666;font-weight:bold;font-size:11px">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;Close Date:
             <!-- <p font-color="Grey"><b>Close Date:</b></p>-->
             </apex:outputLabel> 
             
                <apex:inputField id="from" required="false" label="From:" value="{!dateFromOpp.CloseDate}"/>
                <apex:inputField id="to" required="false" label="To:" value="{!dateToOpp.CloseDate}"/>

             <!-- &nbsp;&nbsp; To &nbsp;&nbsp;<apex:input label="To" id="cdto" value="{!toDate}" type="date"/>-->
                
              
            <apex:inputtext label="Country" id="cname" value="{!country}" />
          
          <!-- <apex:outputLabel value="Close Date:"/>
           <br/>
               <apex:outputLabel value="From"/>
               <apex:input id="cdfrom" value="{!fromDate}" type="date"/>
               <apex:outputLabel value="To"/>
               <apex:input id="cdto" value="{!toDate}" type="date"/>
           -->
              
        </apex:pageBlockSection>      
        <apex:pageBlockButtons location="bottom">
            <apex:commandButton action="{!displayReport}"  value="Generate Report" ID="ENTER_BUTTON"/>
            <apex:actionStatus id="findOpportunityStatus">
                <apex:facet name="start">
                    <img src="{!$Resource.spin}" border="0" width = "20" height = "20"/>
                </apex:facet>
                <apex:facet name="stop">&nbsp;</apex:facet> 
            </apex:actionStatus>
        </apex:pageBlockButtons>
    </apex:pageblock>
    
    <apex:pageBlock id="pbb">
    
    <apex:actionStatus id="myStatusOpportunity">
            <apex:facet name="start">
                <img src="{!$Resource.spin}" border="0" width = "10" height = "10"/><b>...</b>
            </apex:facet>
            <apex:facet name="stop">&nbsp;</apex:facet> 
        </apex:actionStatus>

    
    <apex:pageBlockButtons location="top" id="pbbbuttons">
            <apex:commandButton rerender="pbb" action="{!firstPageOpportunity}"  value="|< First"  disabled="{!hasPreviousOpportunity}" status="myStatusOpportunity"></apex:commandButton>
            <apex:commandButton rerender="pbb" action="{!previousPageOpportunity}" value="<< Previous" disabled="{!hasPreviousOpportunity}" status="myStatusOpportunity"></apex:commandButton>
            <apex:commandButton rerender="pbb" action="{!nextPageOpportunity}" value="Next >>" disabled="{!hasNextOpportunity}" status="myStatusOpportunity"></apex:commandButton>
            <apex:commandButton rerender="pbb" action="{!lastPageOpportunity}" value="Last >|" disabled="{!hasNextOpportunity}" status="myStatusOpportunity"></apex:commandButton>
        </apex:pageBlockButtons>


    <apex:pageBlockTable value="{!opportunityRecords}" var="opp">  >  
        <apex:column headerValue="Opportunity Name">{!opp.name}
        </apex:column> 
        <apex:column headerValue="Opportunity Owner">{!opp.owner.name}</apex:column>
        <apex:column headerValue="Region">{!opp.GEBRegion__c}</apex:column>
        <apex:column headerValue="Country">{!opp.Country__c}</apex:column>
        <apex:column headerValue="Broker/Partner">{!opp.Broker__c}</apex:column>
        <apex:column headerValue="Estimated Premium(Converted)">{!opp.Total_Actual_Sale_Amount__c}</apex:column>
        <apex:column headerValue="Close date">{!opp.CloseDate}</apex:column>
        <apex:column headerValue="Stage">{!opp.StageName}</apex:column>
        <apex:column headerValue="Created stage">{!opp.Creation_Stage_Name__c}</apex:column>
        <apex:column headerValue="Account">{!opp.account.name}</apex:column>
        <apex:column headerValue="Parent Account">{!opp.account.parent.name}</apex:column>
        
    </apex:pageBlockTable>

    </apex:pageblock>

 </apex:form> 
 
</apex:page>

Part of Apex code 
 
public class GVWS_GenerateReport
{
  public String region{get;set;}
  public String country{get;set;}
  //public String closeDate{get;set;}
  //public String hasPrevious {get;set;}
  public Opportunity dateFromOpp {get;set;}
  public Opportunity dateToOpp {get;set;}
  public Date fromDate{get;set;}
  public Date toDate{get;set;}
  public List<Opportunity> opportunityRecords{get;set;}
  
   ApexPages.StandardSetController regionStandardSetController{get;set;}
  
  public GVWS_GenerateReport()
  {
    opportunityRecords = new list<Opportunity>();
    regionStandardSetController=new ApexPages.StandardSetController(new list<Opportunity>());
    dateFromOpp = new Opportunity();
    dateToOpp = new Opportunity();
  }
  
    //List<Opportunity> reportQuery=new List<Opportunity>();
   //reportQuery='SELECT Id,Name,Owner,Broker__c,GVWS_Region__c,GVWS_Country__c ,CloseDate,StageName FROM Opportunity';
   String reportQuery1 ='SELECT Id,Name,Owner.Name,Broker__c,Country__c,GEBRegion__c,CloseDate,StageName,Creation_Stage_Name__c,Total_Actual_Sale_Amount__c, account.name, account.parent.name FROM Opportunity WHERE StageName NOT IN (';
   String reportQuery2 = 'Ommitted';
   String reportQuery3 = 'Inforce';
   String reportQuery4 = 'Lost';
   String reportQuery5 = 'Declined';
   String reportQuery6 = ')';
   String reportQuery = reportQuery1+':'+'reportQuery2'+','+':'+'reportQuery3'+','+':'+'reportQuery4'+','+':'+'reportQuery5'+reportQuery6;
  
   
     
    
   public void displayReport()
 {
 
        Date todate = dateToOpp.CloseDate;
        Date fromdate = dateFromOpp.CloseDate;
        String checkQuery = reportQuery;
        String checkInput = reportQuery;
        
        if(region!= null && !region.equalsIgnoreCase(''))
        {
          
            checkQuery = checkQuery + 'and GEBRegion__c like :region';
            system.debug('***********1'+checkQuery);
        }
        
        if(country!= null && !country.equalsIgnoreCase(''))
        {
         
            checkQuery = checkQuery + ' '+'and Country__c like :country';
            system.debug('***********2'+checkQuery);
        }
        
        if((fromDate!= null)&&(toDate!=null))
        {
          checkQuery=checkQuery+' '+'and (closeDate>=:fromDate AND closeDate<= :toDate)';
          system.debug('************3'+checkQuery);
        }
        
        if(((fromDate!=null)&&(toDate==null))||((fromDate==null)&&(toDate!=null)))
        {
         ApexPages.addMessage(new ApexPages.Message(ApexPages.Severity.Info,'Please Enter value in both From and To search criteria'));
            opportunityRecords = new list<Opportunity>();
            return;
        }
        if(checkQuery.equals(checkInput)){
            ApexPages.addMessage(new ApexPages.Message(ApexPages.Severity.Info,'Please Enter value in at least one search criteria'));
            opportunityRecords = new list<Opportunity>();
            return;
        }
     
      
      //   system.debug('***********1'+checkQuery);
       
        
       
       regionStandardSetController=new ApexPages.StandardSetController(Database.getQueryLocator(checkQuery));
       
        opportunityRecords= regionStandardSetController.getRecords();
        
}

}


Please help me to write the code which will work in both visualforce and apex code.And my another question is how to make the page layout better in salesforce1(ipad).


Thanks,
Lahari



   
Hi experts,

I am a newBie .I have a requirement where i have to select a range of date in visualforce page.Based on that range i have to fetch the details.I have used which is working fine.But this is not displaying a datepicker when i run in IE browser.It only works in chrome.

What coding approach i have to follow.Please help me in solving this.


Below is the visualforce page and apex code which i have written.

Visualforce page
 
<apex:page Controller="GVWS_GenerateReport" docType="html-5.0">

<apex:sectionHeader title="Reports" subtitle="Generate Report" id="sectionHeaderId"/>

 <apex:form id="ReportRegion">
    <apex:outputPanel id="msgPanel">
        <apex:pageMessages ></apex:pageMessages>
    </apex:outputPanel>
    <apex:pageblock id="pb">
    
        <apex:pageBlockSection id="SearchPanel" showHeader="true" columns="2">
           <!-- <apex:outputLabel value="Region"/>-->
            <apex:inputtext label="Region" id="rname" value="{!region}"/>
           <!-- <apex:outputLabel value="Country"/>
           <apex:outputLabel value="Close Date:"> -->
              <apex:outputLabel style="color:#666666;font-weight:bold;font-size:11px">CloseDate:
             <!-- <p font-color="Grey"><b>Close Date:</b></p>-->
              <br/>
              From &nbsp;&nbsp;<apex:input label="From" id="cdfrom" value="{!fromDate}" type="date"/>
              &nbsp;&nbsp; To &nbsp;&nbsp;<apex:input label="To" id="cdto" value="{!toDate}" type="date"/>
              </apex:outputLabel> 
              
            <apex:inputtext label="Country" id="cname" value="{!country}" />
          <!-- <apex:outputLabel value="Close Date:"/>
           <br/>
               <apex:outputLabel value="From"/>
               <apex:input id="cdfrom" value="{!fromDate}" type="date"/>
               <apex:outputLabel value="To"/>
               <apex:input id="cdto" value="{!toDate}" type="date"/>
           -->
              
        </apex:pageBlockSection>      
        <apex:pageBlockButtons location="bottom">
            <apex:commandButton action="{!displayReport}"  value="Generate Report" ID="ENTER_BUTTON"/>
            <apex:actionStatus id="findOpportunityStatus">
                <apex:facet name="start">
                    <img src="{!$Resource.spin}" border="0" width = "20" height = "20"/>
                </apex:facet>
                <apex:facet name="stop">&nbsp;</apex:facet> 
            </apex:actionStatus>
        </apex:pageBlockButtons>
    </apex:pageblock>
    
    <apex:pageBlock id="pbb">
    
    <apex:actionStatus id="myStatusOpportunity">
            <apex:facet name="start">
                <img src="{!$Resource.spin}" border="0" width = "10" height = "10"/><b>...</b>
            </apex:facet>
            <apex:facet name="stop">&nbsp;</apex:facet> 
        </apex:actionStatus>

    
    <apex:pageBlockButtons location="top" id="pbbbuttons">
            <apex:commandButton rerender="pbb" action="{!firstPageOpportunity}"  value="|< First"  disabled="{!hasPreviousOpportunity}" status="myStatusOpportunity"></apex:commandButton>
            <apex:commandButton rerender="pbb" action="{!previousPageOpportunity}" value="<< Previous" disabled="{!hasPreviousOpportunity}" status="myStatusOpportunity"></apex:commandButton>
            <apex:commandButton rerender="pbb" action="{!nextPageOpportunity}" value="Next >>" disabled="{!hasNextOpportunity}" status="myStatusOpportunity"></apex:commandButton>
            <apex:commandButton rerender="pbb" action="{!lastPageOpportunity}" value="Last >|" disabled="{!hasNextOpportunity}" status="myStatusOpportunity"></apex:commandButton>
        </apex:pageBlockButtons>


    <apex:pageBlockTable value="{!opportunityRecords}" var="opp">  >  
        <apex:column headerValue="Opportunity Name">{!opp.name}
        </apex:column> 
        <apex:column headerValue="Opportunity Owner">{!opp.owner.name}</apex:column>
        <apex:column headerValue="Region">{!opp.GEBRegion__c}</apex:column>
        <apex:column headerValue="Country">{!opp.Country__c}</apex:column>
        <apex:column headerValue="Broker/Partner">{!opp.Broker__c}</apex:column>
        <apex:column headerValue="Estimated Premium(Converted)">{!opp.Total_Actual_Sale_Amount__c}</apex:column>
        <apex:column headerValue="Close date">{!opp.CloseDate}</apex:column>
        <apex:column headerValue="Stage">{!opp.StageName}</apex:column>
        <apex:column headerValue="Created stage">{!opp.Creation_Stage_Name__c}</apex:column>
    </apex:pageBlockTable>

    </apex:pageblock>

 </apex:form> 
</apex:page>

Apex class
 
public class GVWS_GenerateReport
{
  public String region{get;set;}
  public String country{get;set;}
  public String closeDate{get;set;}
  public String hasPrevious {get;set;}
  //public Date from{get;set;}
  public Date fromDate{get;set;}
  public Date toDate{get;set;}
  public List<Opportunity> opportunityRecords{get;set;}
  
   ApexPages.StandardSetController regionStandardSetController{get;set;}
  
  public GVWS_GenerateReport()
  {
    opportunityRecords = new list<Opportunity>();
    regionStandardSetController=new ApexPages.StandardSetController(new list<Opportunity>());
  
  }
  
    //List<Opportunity> reportQuery=new List<Opportunity>();
   //reportQuery='SELECT Id,Name,Owner,Broker__c,GVWS_Region__c,GVWS_Country__c ,CloseDate,StageName FROM Opportunity';
   String reportQuery1 ='SELECT Id,Name,Owner.Name,Broker__c,Country__c,GEBRegion__c,CloseDate,StageName,Creation_Stage_Name__c,Total_Actual_Sale_Amount__c FROM Opportunity WHERE StageName NOT IN (';
   String reportQuery2 = 'Ommitted';
   String reportQuery3 = 'Inforce';
   String reportQuery4 = 'Lost';
   String reportQuery5 = 'Declined';
   String reportQuery6 = ')';
   String reportQuery = reportQuery1+':'+'reportQuery2'+','+':'+'reportQuery3'+','+':'+'reportQuery4'+','+':'+'reportQuery5'+reportQuery6;
  
   
     
    
   public void displayReport()
 {
        String checkQuery = reportQuery;
        String checkInput = reportQuery;
        if(region!= null && !region.equalsIgnoreCase(''))
        {
          
            checkQuery = checkQuery + 'and GEBRegion__c like :region';
            system.debug('***********1'+checkQuery);
        }
        
        if(country!= null && !country.equalsIgnoreCase(''))
        {
         
            checkQuery = checkQuery + ' '+'and Country__c like :country';
            system.debug('***********2'+checkQuery);
        }
        
        if((fromDate!= null)&&(toDate!=null))
        {
          checkQuery=checkQuery+' '+'and (closeDate>=:fromDate AND closeDate<= :toDate)';
          system.debug('************3'+checkQuery);
        }
        
        if(((fromDate!=null)&&(toDate==null))||((fromDate==null)&&(toDate!=null)))
        {
         ApexPages.addMessage(new ApexPages.Message(ApexPages.Severity.Info,'Please Enter value in both From and To search criteria'));
            opportunityRecords = new list<Opportunity>();
            return;
        }
        if(checkQuery.equals(checkInput)){
            ApexPages.addMessage(new ApexPages.Message(ApexPages.Severity.Info,'Please Enter value in at least one search criteria'));
            opportunityRecords = new list<Opportunity>();
            return;
        }
     
      
      //   system.debug('***********1'+checkQuery);
       
        
       
       regionStandardSetController=new ApexPages.StandardSetController(Database.getQueryLocator(checkQuery));
       
        opportunityRecords= regionStandardSetController.getRecords();
        
}
  
    public PageReference firstPageOpportunity() {
        regionStandardSetController.first();
        opportunityRecords = regionStandardSetController.getRecords();
        hasPreviousOpportunity = !regionStandardSetController.getHasPrevious();
        hasNextOpportunity= !regionStandardSetController.getHasNext();
        
        return null;
    }
    
    /*
        Shows last set of records in account search result.
    */
    public PageReference lastPageOpportunity() {
        regionStandardSetController.last();
        opportunityRecords = regionStandardSetController.getRecords();
        hasPreviousOpportunity= !regionStandardSetController.getHasPrevious();
        hasNextOpportunity= !regionStandardSetController.getHasNext();
        
        return null;
    }
    
    /*
        Shows next set of records in account search result.
    */
    public PageReference nextPageOpportunity() {
        regionStandardSetController.next();
        opportunityRecords = regionStandardSetController.getRecords();
        hasPreviousOpportunity= !regionStandardSetController.getHasPrevious();
        hasNextOpportunity= !regionStandardSetController.getHasNext();
        
        return null;
    }
    
    /*
        Shows previous set of records in account search result.
    */
   public PageReference previousPageOpportunity() {
        regionStandardSetController.previous();
        opportunityRecords = regionStandardSetController.getRecords();
        hasPreviousOpportunity= !regionStandardSetController.getHasPrevious();
        hasNextOpportunity= !regionStandardSetController.getHasNext();
        
        return null;
    }
    
   public Boolean hasNextOpportunity{
        get {
            if(regionStandardSetController==null&&regionStandardSetController.getHasNext()==true)
                return true;
            return !regionStandardSetController.getHasNext();
        }
        set;
    }
    
    
    public Boolean hasPreviousOpportunity{
        get {
            if(regionStandardSetController==null)
               return true;
            return !regionStandardSetController.getHasPrevious();
        }
        set;
    }  
 
  }

Thanks & regards,
Lahari


 
Hi experts,
                I am new to salesforce.I have a requirement where i need to provide search for FromDate and Todate on this range the closeDate should be displayed.I have tried as below but i am getting error.Please help.

 VF page
<apex:page Controller="GVWS_RegionCountry">

<apex:sectionHeader title="Reports" subtitle="Generate Report" id="sectionHeaderId"/>

 <apex:form id="ReportRegion">
    <apex:outputPanel id="msgPanel">
        <apex:pageMessages ></apex:pageMessages>
    </apex:outputPanel>
    <apex:pageblock id="pb">
    
        <apex:pageBlockSection id="SearchPanel" showHeader="true" columns="2">
            <apex:outputLabel value="Region"/>
            <apex:inputtext id="rname" value="{!region}"/>
            <apex:outputLabel value="Country"/>
            <apex:inputtext id="cname" value="{!country}" />
           <apex:outputLabel value="Close Date:"/>
           <br/>
               <apex:outputLabel value="From"/>
               <apex:inputtext id="cdfrom" value="{!fromDate}"/>
               <apex:outputLabel value="To"/>
               <apex:inputtext id="cdto" value="{!toDate}"/>
               
               
         
        </apex:pageBlockSection>      
        <apex:pageBlockButtons location="bottom">
            <apex:commandButton action="{!displayReport}"  value="Generate Report" ID="ENTER_BUTTON"/>
        </apex:pageBlockButtons>
    </apex:pageblock>
    
    <apex:pageBlock id="pbb">
    <apex:pageBlockTable value="{!opportunityRecords}" var="opp">  >  
        <apex:column headerValue="Opportunity Name">{!opp.name}
        </apex:column> 
        <apex:column headerValue="Opportunity Owner">{!opp.owner.name}</apex:column>
        <apex:column headerValue="Region">{!opp.GEBRegion__c}</apex:column>
        <apex:column headerValue="Country">{!opp.Country__c}</apex:column>
        <apex:column headerValue="Broker/Partner">{!opp.Broker__c}</apex:column>
        <apex:column headerValue="Estimated Premium(Converted)"></apex:column>
        <apex:column headerValue="Close date">{!opp.CloseDate}</apex:column>
        <apex:column headerValue="Stage">{!opp.StageName}</apex:column>
        <apex:column headerValue="Created stage"></apex:column>
    </apex:pageBlockTable>

    </apex:pageblock>

 </apex:form>
</apex:page>

Controller
public class GVWS_RegionCountry 
{
  public String region{get;set;}
  public String country{get;set;}
  public String closeDate{get;set;}
  //public Date from{get;set;}
  public Date fromDate{get;set;}
  public Date toDate{get;set;}
  public List<Opportunity> opportunityRecords{get;set;}
  
   ApexPages.StandardSetController regionStandardSetController{get;set;}
  
  public GVWS_RegionCountry()
  {
    opportunityRecords = new list<Opportunity>();
    regionStandardSetController=new ApexPages.StandardSetController(new list<Opportunity>());
  
  }
  
   
 
   //List<Opportunity> reportQuery=new List<Opportunity>();
   //reportQuery='SELECT Id,Name,Owner,Broker__c,GVWS_Region__c,GVWS_Country__c ,CloseDate,StageName FROM Opportunity';
   String reportQuery1 ='SELECT Id,Name,Owner.Name,Broker__c,Country__c,GEBRegion__c,CloseDate,StageName FROM Opportunity WHERE StageName NOT IN (';
   String reportQuery2 = 'Ommitted';
   String reportQuery3 = 'Inforce';
   String reportQuery4 = 'Lost';
   String reportQuery5 = 'Declined';
   String reportQuery6 = ')';
   String reportQuery = reportQuery1+':'+'reportQuery2'+','+':'+'reportQuery3'+','+':'+'reportQuery4'+','+':'+'reportQuery5'+reportQuery6;
  
   
     
    
   public void displayReport()
 {
        String checkQuery = reportQuery;
        String checkInput = reportQuery;
        if(region!= null && !region.equalsIgnoreCase(''))
        {
          
            checkQuery = checkQuery + 'and GEBRegion__c like :region';
            system.debug('***********1'+checkQuery);
        }
        
        if(country!= null && !country.equalsIgnoreCase(''))
        {
         
            checkQuery = checkQuery + ' '+'and Country__c like :country';
            system.debug('***********2'+checkQuery);
        }
        
        if((fromDate!= null)&&(toDate!=null))
        {
          checkQuery=checkQuery+' '+'and (closeDate>=:fromDate AND closeDate<= :toDate+1)';
          system.debug('************3'+checkQuery);
        }
      
        if(checkQuery.equals(checkInput)){
            ApexPages.addMessage(new ApexPages.Message(ApexPages.Severity.Info,'Please Enter value in at least one search criteria'));
            opportunityRecords = new list<Opportunity>();
            return;
        }
      //   system.debug('***********1'+checkQuery);
      
       
       regionStandardSetController=new ApexPages.StandardSetController(Database.getQueryLocator(checkQuery));
       
        opportunityRecords= regionStandardSetController.getRecords();
        
}
      
}

Please help me with this.


Thanks & regards,
Lahari

 
Hi all,
         I am new to salesforce development.I have to fetch the contact details like FirstName,LastName,Phone,Email,MailingAddress of a selected record of  account object and display it in the tabular format in vf page.
I tried with this query in controller :-
               Private id AccountId;
               this.accountRecord = (Account)controller.getRecord();
              this.AccountId = this.accountRecord.id;
              List<Contact> details= new List<Contact>();
              details = [SELECT FirstName,LastName,Phone,Role__c,Email,MailingAddress FROM Contact WHERE AccountId=:this.AccountId];
       I am getting the required output for few records,and few records its showing "List index out of bounds: 0 " error.
         Please help me with this.


Thanks & Regards,
Lahari
           
Hi experts,

I am a newBie .I have a requirement where i have to select a range of date in visualforce page.Based on that range i have to fetch the details.I have used which is working fine.But this is not displaying a datepicker when i run in IE browser.It only works in chrome.

What coding approach i have to follow.Please help me in solving this.


Below is the visualforce page and apex code which i have written.

Visualforce page
 
<apex:page Controller="GVWS_GenerateReport" docType="html-5.0">

<apex:sectionHeader title="Reports" subtitle="Generate Report" id="sectionHeaderId"/>

 <apex:form id="ReportRegion">
    <apex:outputPanel id="msgPanel">
        <apex:pageMessages ></apex:pageMessages>
    </apex:outputPanel>
    <apex:pageblock id="pb">
    
        <apex:pageBlockSection id="SearchPanel" showHeader="true" columns="2">
           <!-- <apex:outputLabel value="Region"/>-->
            <apex:inputtext label="Region" id="rname" value="{!region}"/>
           <!-- <apex:outputLabel value="Country"/>
           <apex:outputLabel value="Close Date:"> -->
              <apex:outputLabel style="color:#666666;font-weight:bold;font-size:11px">CloseDate:
             <!-- <p font-color="Grey"><b>Close Date:</b></p>-->
              <br/>
              From &nbsp;&nbsp;<apex:input label="From" id="cdfrom" value="{!fromDate}" type="date"/>
              &nbsp;&nbsp; To &nbsp;&nbsp;<apex:input label="To" id="cdto" value="{!toDate}" type="date"/>
              </apex:outputLabel> 
              
            <apex:inputtext label="Country" id="cname" value="{!country}" />
          <!-- <apex:outputLabel value="Close Date:"/>
           <br/>
               <apex:outputLabel value="From"/>
               <apex:input id="cdfrom" value="{!fromDate}" type="date"/>
               <apex:outputLabel value="To"/>
               <apex:input id="cdto" value="{!toDate}" type="date"/>
           -->
              
        </apex:pageBlockSection>      
        <apex:pageBlockButtons location="bottom">
            <apex:commandButton action="{!displayReport}"  value="Generate Report" ID="ENTER_BUTTON"/>
            <apex:actionStatus id="findOpportunityStatus">
                <apex:facet name="start">
                    <img src="{!$Resource.spin}" border="0" width = "20" height = "20"/>
                </apex:facet>
                <apex:facet name="stop">&nbsp;</apex:facet> 
            </apex:actionStatus>
        </apex:pageBlockButtons>
    </apex:pageblock>
    
    <apex:pageBlock id="pbb">
    
    <apex:actionStatus id="myStatusOpportunity">
            <apex:facet name="start">
                <img src="{!$Resource.spin}" border="0" width = "10" height = "10"/><b>...</b>
            </apex:facet>
            <apex:facet name="stop">&nbsp;</apex:facet> 
        </apex:actionStatus>

    
    <apex:pageBlockButtons location="top" id="pbbbuttons">
            <apex:commandButton rerender="pbb" action="{!firstPageOpportunity}"  value="|< First"  disabled="{!hasPreviousOpportunity}" status="myStatusOpportunity"></apex:commandButton>
            <apex:commandButton rerender="pbb" action="{!previousPageOpportunity}" value="<< Previous" disabled="{!hasPreviousOpportunity}" status="myStatusOpportunity"></apex:commandButton>
            <apex:commandButton rerender="pbb" action="{!nextPageOpportunity}" value="Next >>" disabled="{!hasNextOpportunity}" status="myStatusOpportunity"></apex:commandButton>
            <apex:commandButton rerender="pbb" action="{!lastPageOpportunity}" value="Last >|" disabled="{!hasNextOpportunity}" status="myStatusOpportunity"></apex:commandButton>
        </apex:pageBlockButtons>


    <apex:pageBlockTable value="{!opportunityRecords}" var="opp">  >  
        <apex:column headerValue="Opportunity Name">{!opp.name}
        </apex:column> 
        <apex:column headerValue="Opportunity Owner">{!opp.owner.name}</apex:column>
        <apex:column headerValue="Region">{!opp.GEBRegion__c}</apex:column>
        <apex:column headerValue="Country">{!opp.Country__c}</apex:column>
        <apex:column headerValue="Broker/Partner">{!opp.Broker__c}</apex:column>
        <apex:column headerValue="Estimated Premium(Converted)">{!opp.Total_Actual_Sale_Amount__c}</apex:column>
        <apex:column headerValue="Close date">{!opp.CloseDate}</apex:column>
        <apex:column headerValue="Stage">{!opp.StageName}</apex:column>
        <apex:column headerValue="Created stage">{!opp.Creation_Stage_Name__c}</apex:column>
    </apex:pageBlockTable>

    </apex:pageblock>

 </apex:form> 
</apex:page>

Apex class
 
public class GVWS_GenerateReport
{
  public String region{get;set;}
  public String country{get;set;}
  public String closeDate{get;set;}
  public String hasPrevious {get;set;}
  //public Date from{get;set;}
  public Date fromDate{get;set;}
  public Date toDate{get;set;}
  public List<Opportunity> opportunityRecords{get;set;}
  
   ApexPages.StandardSetController regionStandardSetController{get;set;}
  
  public GVWS_GenerateReport()
  {
    opportunityRecords = new list<Opportunity>();
    regionStandardSetController=new ApexPages.StandardSetController(new list<Opportunity>());
  
  }
  
    //List<Opportunity> reportQuery=new List<Opportunity>();
   //reportQuery='SELECT Id,Name,Owner,Broker__c,GVWS_Region__c,GVWS_Country__c ,CloseDate,StageName FROM Opportunity';
   String reportQuery1 ='SELECT Id,Name,Owner.Name,Broker__c,Country__c,GEBRegion__c,CloseDate,StageName,Creation_Stage_Name__c,Total_Actual_Sale_Amount__c FROM Opportunity WHERE StageName NOT IN (';
   String reportQuery2 = 'Ommitted';
   String reportQuery3 = 'Inforce';
   String reportQuery4 = 'Lost';
   String reportQuery5 = 'Declined';
   String reportQuery6 = ')';
   String reportQuery = reportQuery1+':'+'reportQuery2'+','+':'+'reportQuery3'+','+':'+'reportQuery4'+','+':'+'reportQuery5'+reportQuery6;
  
   
     
    
   public void displayReport()
 {
        String checkQuery = reportQuery;
        String checkInput = reportQuery;
        if(region!= null && !region.equalsIgnoreCase(''))
        {
          
            checkQuery = checkQuery + 'and GEBRegion__c like :region';
            system.debug('***********1'+checkQuery);
        }
        
        if(country!= null && !country.equalsIgnoreCase(''))
        {
         
            checkQuery = checkQuery + ' '+'and Country__c like :country';
            system.debug('***********2'+checkQuery);
        }
        
        if((fromDate!= null)&&(toDate!=null))
        {
          checkQuery=checkQuery+' '+'and (closeDate>=:fromDate AND closeDate<= :toDate)';
          system.debug('************3'+checkQuery);
        }
        
        if(((fromDate!=null)&&(toDate==null))||((fromDate==null)&&(toDate!=null)))
        {
         ApexPages.addMessage(new ApexPages.Message(ApexPages.Severity.Info,'Please Enter value in both From and To search criteria'));
            opportunityRecords = new list<Opportunity>();
            return;
        }
        if(checkQuery.equals(checkInput)){
            ApexPages.addMessage(new ApexPages.Message(ApexPages.Severity.Info,'Please Enter value in at least one search criteria'));
            opportunityRecords = new list<Opportunity>();
            return;
        }
     
      
      //   system.debug('***********1'+checkQuery);
       
        
       
       regionStandardSetController=new ApexPages.StandardSetController(Database.getQueryLocator(checkQuery));
       
        opportunityRecords= regionStandardSetController.getRecords();
        
}
  
    public PageReference firstPageOpportunity() {
        regionStandardSetController.first();
        opportunityRecords = regionStandardSetController.getRecords();
        hasPreviousOpportunity = !regionStandardSetController.getHasPrevious();
        hasNextOpportunity= !regionStandardSetController.getHasNext();
        
        return null;
    }
    
    /*
        Shows last set of records in account search result.
    */
    public PageReference lastPageOpportunity() {
        regionStandardSetController.last();
        opportunityRecords = regionStandardSetController.getRecords();
        hasPreviousOpportunity= !regionStandardSetController.getHasPrevious();
        hasNextOpportunity= !regionStandardSetController.getHasNext();
        
        return null;
    }
    
    /*
        Shows next set of records in account search result.
    */
    public PageReference nextPageOpportunity() {
        regionStandardSetController.next();
        opportunityRecords = regionStandardSetController.getRecords();
        hasPreviousOpportunity= !regionStandardSetController.getHasPrevious();
        hasNextOpportunity= !regionStandardSetController.getHasNext();
        
        return null;
    }
    
    /*
        Shows previous set of records in account search result.
    */
   public PageReference previousPageOpportunity() {
        regionStandardSetController.previous();
        opportunityRecords = regionStandardSetController.getRecords();
        hasPreviousOpportunity= !regionStandardSetController.getHasPrevious();
        hasNextOpportunity= !regionStandardSetController.getHasNext();
        
        return null;
    }
    
   public Boolean hasNextOpportunity{
        get {
            if(regionStandardSetController==null&&regionStandardSetController.getHasNext()==true)
                return true;
            return !regionStandardSetController.getHasNext();
        }
        set;
    }
    
    
    public Boolean hasPreviousOpportunity{
        get {
            if(regionStandardSetController==null)
               return true;
            return !regionStandardSetController.getHasPrevious();
        }
        set;
    }  
 
  }

Thanks & regards,
Lahari


 
Hi experts,
                I am new to salesforce.I have a requirement where i need to provide search for FromDate and Todate on this range the closeDate should be displayed.I have tried as below but i am getting error.Please help.

 VF page
<apex:page Controller="GVWS_RegionCountry">

<apex:sectionHeader title="Reports" subtitle="Generate Report" id="sectionHeaderId"/>

 <apex:form id="ReportRegion">
    <apex:outputPanel id="msgPanel">
        <apex:pageMessages ></apex:pageMessages>
    </apex:outputPanel>
    <apex:pageblock id="pb">
    
        <apex:pageBlockSection id="SearchPanel" showHeader="true" columns="2">
            <apex:outputLabel value="Region"/>
            <apex:inputtext id="rname" value="{!region}"/>
            <apex:outputLabel value="Country"/>
            <apex:inputtext id="cname" value="{!country}" />
           <apex:outputLabel value="Close Date:"/>
           <br/>
               <apex:outputLabel value="From"/>
               <apex:inputtext id="cdfrom" value="{!fromDate}"/>
               <apex:outputLabel value="To"/>
               <apex:inputtext id="cdto" value="{!toDate}"/>
               
               
         
        </apex:pageBlockSection>      
        <apex:pageBlockButtons location="bottom">
            <apex:commandButton action="{!displayReport}"  value="Generate Report" ID="ENTER_BUTTON"/>
        </apex:pageBlockButtons>
    </apex:pageblock>
    
    <apex:pageBlock id="pbb">
    <apex:pageBlockTable value="{!opportunityRecords}" var="opp">  >  
        <apex:column headerValue="Opportunity Name">{!opp.name}
        </apex:column> 
        <apex:column headerValue="Opportunity Owner">{!opp.owner.name}</apex:column>
        <apex:column headerValue="Region">{!opp.GEBRegion__c}</apex:column>
        <apex:column headerValue="Country">{!opp.Country__c}</apex:column>
        <apex:column headerValue="Broker/Partner">{!opp.Broker__c}</apex:column>
        <apex:column headerValue="Estimated Premium(Converted)"></apex:column>
        <apex:column headerValue="Close date">{!opp.CloseDate}</apex:column>
        <apex:column headerValue="Stage">{!opp.StageName}</apex:column>
        <apex:column headerValue="Created stage"></apex:column>
    </apex:pageBlockTable>

    </apex:pageblock>

 </apex:form>
</apex:page>

Controller
public class GVWS_RegionCountry 
{
  public String region{get;set;}
  public String country{get;set;}
  public String closeDate{get;set;}
  //public Date from{get;set;}
  public Date fromDate{get;set;}
  public Date toDate{get;set;}
  public List<Opportunity> opportunityRecords{get;set;}
  
   ApexPages.StandardSetController regionStandardSetController{get;set;}
  
  public GVWS_RegionCountry()
  {
    opportunityRecords = new list<Opportunity>();
    regionStandardSetController=new ApexPages.StandardSetController(new list<Opportunity>());
  
  }
  
   
 
   //List<Opportunity> reportQuery=new List<Opportunity>();
   //reportQuery='SELECT Id,Name,Owner,Broker__c,GVWS_Region__c,GVWS_Country__c ,CloseDate,StageName FROM Opportunity';
   String reportQuery1 ='SELECT Id,Name,Owner.Name,Broker__c,Country__c,GEBRegion__c,CloseDate,StageName FROM Opportunity WHERE StageName NOT IN (';
   String reportQuery2 = 'Ommitted';
   String reportQuery3 = 'Inforce';
   String reportQuery4 = 'Lost';
   String reportQuery5 = 'Declined';
   String reportQuery6 = ')';
   String reportQuery = reportQuery1+':'+'reportQuery2'+','+':'+'reportQuery3'+','+':'+'reportQuery4'+','+':'+'reportQuery5'+reportQuery6;
  
   
     
    
   public void displayReport()
 {
        String checkQuery = reportQuery;
        String checkInput = reportQuery;
        if(region!= null && !region.equalsIgnoreCase(''))
        {
          
            checkQuery = checkQuery + 'and GEBRegion__c like :region';
            system.debug('***********1'+checkQuery);
        }
        
        if(country!= null && !country.equalsIgnoreCase(''))
        {
         
            checkQuery = checkQuery + ' '+'and Country__c like :country';
            system.debug('***********2'+checkQuery);
        }
        
        if((fromDate!= null)&&(toDate!=null))
        {
          checkQuery=checkQuery+' '+'and (closeDate>=:fromDate AND closeDate<= :toDate+1)';
          system.debug('************3'+checkQuery);
        }
      
        if(checkQuery.equals(checkInput)){
            ApexPages.addMessage(new ApexPages.Message(ApexPages.Severity.Info,'Please Enter value in at least one search criteria'));
            opportunityRecords = new list<Opportunity>();
            return;
        }
      //   system.debug('***********1'+checkQuery);
      
       
       regionStandardSetController=new ApexPages.StandardSetController(Database.getQueryLocator(checkQuery));
       
        opportunityRecords= regionStandardSetController.getRecords();
        
}
      
}

Please help me with this.


Thanks & regards,
Lahari

 
Hi all,
         I am new to salesforce development.I have to fetch the contact details like FirstName,LastName,Phone,Email,MailingAddress of a selected record of  account object and display it in the tabular format in vf page.
I tried with this query in controller :-
               Private id AccountId;
               this.accountRecord = (Account)controller.getRecord();
              this.AccountId = this.accountRecord.id;
              List<Contact> details= new List<Contact>();
              details = [SELECT FirstName,LastName,Phone,Role__c,Email,MailingAddress FROM Contact WHERE AccountId=:this.AccountId];
       I am getting the required output for few records,and few records its showing "List index out of bounds: 0 " error.
         Please help me with this.


Thanks & Regards,
Lahari