• Suma
  • NEWBIE
  • 20 Points
  • Member since 2014

  • Chatter
    Feed
  • 0
    Best Answers
  • 1
    Likes Received
  • 0
    Likes Given
  • 4
    Questions
  • 4
    Replies
I have a visual force page to display a list of locations. I used pagination and wrote class for it and working finely. but the test class is giving me an error : Constructor not defined: [listView].()
Can you please help. Below is my code:
This is my Constructor class.

public class listView{
    ApexPages.StandardSetController con; 
    
  //controller
  public listView(ApexPages.StandardSetController con)
    {        
     this.con = con;
      con.setPageSize(20);   
     }   

    //Instantiate the StandardSetController   
    //public ApexPages.StandardSetController con{get; set;}   
       
    //Boolean to check if there are more records after the present displaying records   
    public Boolean hasNext   
    {   
        get   
        {   
            return con.getHasNext();   
        }   
        set;   
    }   
    
    //Boolean to check if there are more records before the present displaying records   
    public Boolean hasPrevious   
    {   
        get   
        {   
            return con.getHasPrevious();   
        }   
        set;   
    }   
    
    //Page number of the current displaying records   
    public Integer pageNumber   
    {   
        get   
        {   
            return con.getPageNumber();   
        }   
        set;   
    }   
  
    //Returns the previous page of records   
    public void previous()   
    {   
        con.previous();   
    }   
    
    //Returns the next page of records   
    public void next()   
    {   
        con.next();   
    }   
}


This is my Test class:

@isTest(SeeAllData=true)  
public class listViewTest {  

        public static testMethod void testlistView() {  
        PageReference pageRef = Page.DataCenterLocation;  
        Test.setCurrentPage(pageRef);

        // Instantiate a new controller with all parameters in the page

        
        listView lv =new listView();
               
        lv.Next();
       
       
        lv.Previous();
       
        lv.con.getHasPrevious();
        lv.con.getHasNext();
        lv.con.getPageNumber();


     }

}

This is my VF page


<apex:page standardController="Data_Center_Location__c" recordsetVar="dclocation" extensions="listView">
<apex:form > <apex:pageBlock title="Data Center Locations">
<apex:pageBlockSection columns="4">
<apex:pageBlockTable style="width:200%" value="{!dclocation}" var="dclitem">
<apex:column style="width:250px" headerValue="Yardi Location Code">
<apex:outputField value="{!dclitem.Yardi_Location_Code__c}"/> </apex:column>
<apex:column headerValue="Opportunity Location Code">
<apex:outputField style="width:250px" value="{!dclitem.Opportunity_Location_Code__c}"/>
</apex:column>
<apex:column headerValue="Address">
<apex:outputField style="width:250px" value="{!dclitem.Address__c}"/>
</apex:column>
<apex:column headerValue="City">
<apex:outputField style="width:250px" value="{!dclitem.City__c}"/>
</apex:column>
</apex:pageBlockTable>
</apex:pageBlockSection>
<apex:commandLink action="{!Previous}" value="Previous" rendered="{!HasPrevious}"/>&nbsp;&nbsp; <apex:commandLink action="{!Next}" value="Next" rendered="{!HasNext}"/> </apex:pageBlock> </apex:form> </apex:page>

 
  • July 23, 2015
  • Like
  • 0
We have set up a community portal with Account manager as internal users with SF license and partners as external users with partner community license.  How do I share leads of all contacts(the partners) on the account with corresponding account manager? The OWD is public read/write /transfer in my org.
 Really appreciate any thoughts / advise . 

Thanks
  • April 16, 2015
  • Like
  • 0
I am trying to search Contacts details from database using lastname field and dsiplay the table in VF page.  I am able to search and display the existing records in the page but if the record(Contact) is not in the database, I need to display the error message: "Contact could not found".  This is where i am looking for some help.
Code for my controller is:

public with sharing class ContactSearchController
{
    // Global variables
         public List<Contact> contacts{get;set;}
         public String searchString{get;set;}
         
   // Constructor for stand alone page
   
            
         public ContactSearchController()
         {
          searchString = '';
          doSearch();
         }
         
    // Methods for getting List of Contacts
       
         public void doSearch()     
         {
            String queryString = '';
            
            if(searchString!= null)
            {
                queryString = '%'+searchString+'%';
            
                contacts = [SELECT id, name, accountId, email, phone 
                            FROM contact C
                            WHERE lastname LIKE :queryString
                            LIMIT 10];
            
           }
           else
           {
             ApexPages.addMessage(new ApexPages.Message(ApexPages.Severity.ERROR, 'Contact could not found!')); 
                        
         }
        
 }        
}

My VF page is :
<apex:page controller="ContactSearchController" >
<apex:form >

<!-- actionFunction is for calling Controller's method -->
<apex:actionFunction action="{!doSearch}" name="apexdoSearch" reRender="myData,errors"/>

<!-- Filter Section -->
     <label> <b>Filter by Last Name:</b></label>
       <apex:inputText value="{!searchString}" onkeyup="apexdoSearch()"/>
       <br></BR>
       
  

 <!-- My Page Block -->
  <apex:pageBlock title="Find Customer" id="myData">
  <apex:pageMessages id="errors"/>
  <apex:pageBlockTable value="{!contacts}" var="contact">
  <apex:column value="{!contact.name}"/>
  <apex:column value="{!contact.accountid}"/>
  <apex:column value="{!contact.email}"/>
  <apex:column value="{!contact.phone}"/>
  </apex:pageBlockTable>
  </apex:pageBlock>
  </apex:form>
</apex:page>
  • January 08, 2015
  • Like
  • 0
Hi all,
I am trying to upload a managed package to app exchange which contains a service cloud console component with live agent enabled and it gives me upload error "You can't export a console when you have Live Agent enabled." Any suggestions or workarounds for this?  Thanks a lot in advance !  
  • December 04, 2014
  • Like
  • 1
Hi all,
I am trying to upload a managed package to app exchange which contains a service cloud console component with live agent enabled and it gives me upload error "You can't export a console when you have Live Agent enabled." Any suggestions or workarounds for this?  Thanks a lot in advance !  
  • December 04, 2014
  • Like
  • 1
I have a visual force page to display a list of locations. I used pagination and wrote class for it and working finely. but the test class is giving me an error : Constructor not defined: [listView].()
Can you please help. Below is my code:
This is my Constructor class.

public class listView{
    ApexPages.StandardSetController con; 
    
  //controller
  public listView(ApexPages.StandardSetController con)
    {        
     this.con = con;
      con.setPageSize(20);   
     }   

    //Instantiate the StandardSetController   
    //public ApexPages.StandardSetController con{get; set;}   
       
    //Boolean to check if there are more records after the present displaying records   
    public Boolean hasNext   
    {   
        get   
        {   
            return con.getHasNext();   
        }   
        set;   
    }   
    
    //Boolean to check if there are more records before the present displaying records   
    public Boolean hasPrevious   
    {   
        get   
        {   
            return con.getHasPrevious();   
        }   
        set;   
    }   
    
    //Page number of the current displaying records   
    public Integer pageNumber   
    {   
        get   
        {   
            return con.getPageNumber();   
        }   
        set;   
    }   
  
    //Returns the previous page of records   
    public void previous()   
    {   
        con.previous();   
    }   
    
    //Returns the next page of records   
    public void next()   
    {   
        con.next();   
    }   
}


This is my Test class:

@isTest(SeeAllData=true)  
public class listViewTest {  

        public static testMethod void testlistView() {  
        PageReference pageRef = Page.DataCenterLocation;  
        Test.setCurrentPage(pageRef);

        // Instantiate a new controller with all parameters in the page

        
        listView lv =new listView();
               
        lv.Next();
       
       
        lv.Previous();
       
        lv.con.getHasPrevious();
        lv.con.getHasNext();
        lv.con.getPageNumber();


     }

}

This is my VF page


<apex:page standardController="Data_Center_Location__c" recordsetVar="dclocation" extensions="listView">
<apex:form > <apex:pageBlock title="Data Center Locations">
<apex:pageBlockSection columns="4">
<apex:pageBlockTable style="width:200%" value="{!dclocation}" var="dclitem">
<apex:column style="width:250px" headerValue="Yardi Location Code">
<apex:outputField value="{!dclitem.Yardi_Location_Code__c}"/> </apex:column>
<apex:column headerValue="Opportunity Location Code">
<apex:outputField style="width:250px" value="{!dclitem.Opportunity_Location_Code__c}"/>
</apex:column>
<apex:column headerValue="Address">
<apex:outputField style="width:250px" value="{!dclitem.Address__c}"/>
</apex:column>
<apex:column headerValue="City">
<apex:outputField style="width:250px" value="{!dclitem.City__c}"/>
</apex:column>
</apex:pageBlockTable>
</apex:pageBlockSection>
<apex:commandLink action="{!Previous}" value="Previous" rendered="{!HasPrevious}"/>&nbsp;&nbsp; <apex:commandLink action="{!Next}" value="Next" rendered="{!HasNext}"/> </apex:pageBlock> </apex:form> </apex:page>

 
  • July 23, 2015
  • Like
  • 0
I am trying to search Contacts details from database using lastname field and dsiplay the table in VF page.  I am able to search and display the existing records in the page but if the record(Contact) is not in the database, I need to display the error message: "Contact could not found".  This is where i am looking for some help.
Code for my controller is:

public with sharing class ContactSearchController
{
    // Global variables
         public List<Contact> contacts{get;set;}
         public String searchString{get;set;}
         
   // Constructor for stand alone page
   
            
         public ContactSearchController()
         {
          searchString = '';
          doSearch();
         }
         
    // Methods for getting List of Contacts
       
         public void doSearch()     
         {
            String queryString = '';
            
            if(searchString!= null)
            {
                queryString = '%'+searchString+'%';
            
                contacts = [SELECT id, name, accountId, email, phone 
                            FROM contact C
                            WHERE lastname LIKE :queryString
                            LIMIT 10];
            
           }
           else
           {
             ApexPages.addMessage(new ApexPages.Message(ApexPages.Severity.ERROR, 'Contact could not found!')); 
                        
         }
        
 }        
}

My VF page is :
<apex:page controller="ContactSearchController" >
<apex:form >

<!-- actionFunction is for calling Controller's method -->
<apex:actionFunction action="{!doSearch}" name="apexdoSearch" reRender="myData,errors"/>

<!-- Filter Section -->
     <label> <b>Filter by Last Name:</b></label>
       <apex:inputText value="{!searchString}" onkeyup="apexdoSearch()"/>
       <br></BR>
       
  

 <!-- My Page Block -->
  <apex:pageBlock title="Find Customer" id="myData">
  <apex:pageMessages id="errors"/>
  <apex:pageBlockTable value="{!contacts}" var="contact">
  <apex:column value="{!contact.name}"/>
  <apex:column value="{!contact.accountid}"/>
  <apex:column value="{!contact.email}"/>
  <apex:column value="{!contact.phone}"/>
  </apex:pageBlockTable>
  </apex:pageBlock>
  </apex:form>
</apex:page>
  • January 08, 2015
  • Like
  • 0