• sf.dev.ax1103
  • NEWBIE
  • 0 Points
  • Member since 2011

  • Chatter
    Feed
  • 0
    Best Answers
  • 0
    Likes Received
  • 0
    Likes Given
  • 15
    Questions
  • 33
    Replies

Hi All,

 

     Any Idea of how to create pagination in custom related list.Here is my page and class. I need to display 5 oppty records.If there are more than 5 records then i need to show a link  Show More link which goes to next page and displays all records like below.

 



 

 

<apex:page standardController="Contact" extensions="sampleDetailPageCon">
<style>
.fewerMore { display: none;}
</style>
<apex:form >
 <apex:pageMessages />
 <apex:detail relatedList="false"></apex:detail>
<apex:pageblock id="CustomList" title="Related Opportunities"  >
   <apex:pageBlockTable value="{!oppz}" var="o" rendered="{!NOT(ISNULL(oppz))}">
        <apex:column value="{!o.Name}"/>
        <apex:column value="{!o.Account.Name}"/>
        <apex:column value="{!o.Type}"/>
       <apex:column value="{!o.Amount}"></apex:column>
       <apex:column value="{!o.CloseDate}"/>
   </apex:pageBlockTable>
   <apex:outputLabel value="No records to display" rendered="{!(ISNULL(oppz))}" styleClass="noRowsHeader"></apex:outputLabel>
 </apex:pageblock>
</apex:form>
</apex:page>

 

 

 

public class sampleDetailPageCon {
    private List<Opportunity> oppz;
    private Contact cntact;
    public sampleDetailPageCon(ApexPages.StandardController controller) {
        this.cntact= (Contact)controller.getRecord();
    }
    public List<Opportunity> getOppz()
    {
        Contact con = [Select id, Account.id FROM Contact where id = :cntact.id];
        if (con.Account == null)
         return null;
        oppz = [Select id, Name, Account.Name, CloseDate, Amount, Type from Opportunity where Account.id = :con.Account.id];
        return oppz;
    }
}

 

Thanks

Hi,

        I need to display related opportunities for first 5 records.if there are more than 5 records i need a link to show more records in next page.I need similar pagination how default salesforce provides for a related list.Can you please help me in this.

 

 

<apex:page standardController="Contact" extensions="sampleDetailPageCon">
<style>
.fewerMore { display: none;}
</style>
<apex:form >
<apex:pageMessages />
<apex:detail relatedList="true"></apex:detail>
<apex:pageblock id="CustomList" title="Related Opportunities" >
<apex:pageBlockTable value="{!oppz}" var="o" rendered="{!NOT(ISNULL(oppz))}">
<apex:column value="{!o.Name}"/>
<apex:column value="{!o.Account.Name}"/>
<apex:column value="{!o.Type}"/>
<apex:column value="{!o.Amount}"></apex:column>
<apex:column value="{!o.CloseDate}"/>
</apex:pageBlockTable>
<apex:outputLabel value="No records to display" rendered="{!(ISNULL(oppz))}" styleClass="noRowsHeader"></apex:outputLabel>
</apex:pageblock>
</apex:form>
</apex:page>



public class sampleDetailPageCon {
private List<Opportunity> oppz;
private Contact cntact;
public sampleDetailPageCon(ApexPages.StandardController controller) {
this.cntact= (Contact)controller.getRecord();
}
public List<Opportunity> getOppz()
{
Contact con = [Select id, Account.id FROM Contact where id = :cntact.id];
if (con.Account == null)
return null;
oppz = [Select id, Name, Account.Name, CloseDate, Amount, Type from Opportunity where Account.id = :con.Account.id];
return oppz;
}
}



  Thanks



Hi, I have a field in contact which is URL. I want to display button instead of Link in realted list. Like if contact has URL field, then in Account page in the contact related list, that field should show up as button rather than link

 



 

This is something new , I dont have any idea how to do this.

 

 

 Thanks Shailu

Hi All,

 

        I need to get the zip file of all attachments from case object where case status is closed.I tried using export wizard but no hope. Any help of how to extract zip file of all attachments.

 

Thanks

 
I wonder how I could turn one or more worflows from the time I saved an object.
The rule must be obeyed is solely the existence of this object, or so it is saved I want to trigger a workflow with email saying the creation of the object.
Thank you.



Hi All,

 

         My class is not getting covered in below red lines.Any help in fixing in test class

 

public class Web2LeadExtension {

 
  
    public Lead wlead{
    get {
      if (wlead== null)
        wlead= new Lead ();
        return wlead;
    }
    set;
  }
  
    public Web2LeadExtension(ApexPages.StandardController
                                stdController) {
       wlead = (Lead)stdController.getRecord();
     }

     public PageReference saveLead() {
       try {
       insert(wlead);
       }
       catch(System.DMLException e) {
           ApexPages.addMessages(e);
           return null;
       }
       PageReference p = Page.mypage;
       return p;
     }
}

 

 

 

@isTest private class testLeadClass{


static testmethod void saveLeadTest(){
        
     
         Lead l = new Lead(company='test company',lastname='xyz');
         test.starttest();

 


         Web2LeadExtension ext = new Web2LeadExtension(new ApexPages.StandardController(l));

 

PageReference p = ext.saveLead();
         test.stoptest();

 

system.assertEquals(Page.mypage.getUrl(),p.getUrl());
        
      }

}

Thanks

setup a site and a custom object. The site public access guest user profile has full permissions to the custom object.

 

setup a controller and a page to show a record from the custom object. The site guest user also has access to the apex class and the visualforce page.

 

when i load the page as the site guest user i can see any standard fields for the custom object, but it does not show any custom fields for the custom object.

 

no error message just shows nothing.

 

what am i doing wrong?

Hi Team, I want to display the help text in visualforce page but i tried the below code but i am getting so error message.
{!$ObjectType.Request__c.fields.Name__c.InlineHelpText}
Please let me know why I am getting so many error message and please let me know the solution to display help text in visualforce page. Thanks in advance.

Hey all,

 

I am having issues creating a testClass for a sample code from the Cookbook.

http://developer.force.com/cookbook/recipe/creating-a-web-to-lead-form-for-your-force-com-site

 

The controller is very simple and can be seen here:

public class myWeb2LeadExtension {

    private final Lead weblead;

    public myWeb2LeadExtension(ApexPages.StandardController
                                stdController) {
       weblead = (Lead)stdController.getRecord();
    }

     public PageReference saveLead() {
       try {
       insert(weblead);
       }
       catch(System.DMLException e) {
           ApexPages.addMessages(e);
           return null;
       }
       PageReference p = Page.thankyou_getinvolved;
       p.setRedirect(true);
       return p;
     }
}

 

I have written the testClass to insert all required fields for the Lead, but it is still not validating the class. What am I missing?

 

Thank you for your help!

 

Hi All,

 

I have a requirement to add my cases component on home page layout.

How can i go about it without creating a complete visualforce page ?

Hello!

 

I am new to Apex / Visualforce, so will appreciate any help with the following. I have created a custom list using visual force to display all child accounts in a related list. I would like to repeat the same for Contacts of child accounts in the page for parent account.

 

Now, having done that, how do I implement pagination - if the number of contacts / child accounts is significant?

 

See my apex code below:

 

<apex:page standardController="Account" extensions="childAccount">

<style>

.fewerMore { display: none;}

</style>

<apex:form >

 <apex:pageMessages />

 <apex:detail relatedList="true"></apex:detail>

<apex:pageblock id="CustomList" title="Child Accounts"  >

   <apex:pageBlockTable value="{!acctz}" var="o" rendered="{!NOT(ISNULL(acctz))}">

        <apex:column headerValue="Action" >

            <apex:outputLink value="/{!o.id}/e?retURL=/apex/{!$CurrentPage.Name}" style="color:blue; text-decoration:none">Edit</apex:outputLink>

        </apex:column>       

        <apex:column headerValue="Name"> <apex:outputLink value="/{!o.id}">{!o.Name}</apex:outputLink> </apex:column>

        <apex:column value="{!o.Address_Street__c}"/>

        <apex:column value="{!o.Address_City__c}"/>

    <apex:column value="{!o.Office__c}"/>

        <apex:column value="{!o.Type}"/>

   </apex:pageBlockTable>

   <apex:outputLabel value="No records to display" rendered="{!(ISNULL(acctz))}"></apex:outputLabel>

 </apex:pageblock>

 

</apex:form>

</apex:page>

 

 

 

 

public class childAccount {

   

    private List<Account> acctz;

    private Account acct;

 

    public childAccount(ApexPages.StandardController controller) {

        this.acct= (Account)controller.getRecord();

    }

 

    public List<Account> getAcctz()

    {

        Account act = [Select id FROM Account where id = :acct.id];

        acctz = [Select id, Name, Address_Street__c, Address_City__c, Office__c, Type from Account where parentid = :act.id];

    return acctz;

    }

}

 

 

Hello.

Our organization doesn't want our sales reps to see the leads of other reps... but they do want the reps the ability to just check and see if a lead exists in the system before they can enter it in themselves, to prevent competition.

I wasn't able to accomplish this with the Sharing Settings in the UI. I did put together a trigger that, upon actual entering of the lead, it will prevent the lead from being entered if a lead with the same email address already exists. But, they want the reps to be able to do a quick search and see if the lead exists (and what rep it belongs to) before they enter in all of the additional Lead information.

I put together a Visualforce page that has three fields: Last Name, Company, and Email, and will issue a SOQL query to see if any Leads exist that match those values. It will then display the Lead name, company, email and owner to the rep so they know not to enter it themselves (I plan to update the trigger to prevent entry as well). If it doesn't exist, a link will be provided to go ahead and finish entering the Lead details, picking up the last name, company, and email address that they already put in.

This page is basically functional at this point. It needs some tweaking and CSS, but it's working. I'm new to Visualforce, and when I attempted to actually override the "New" button on the Lead tab, I learned that I can only override that button with a Visualforce page that uses the standard Lead controller.

The code for the page and the class is below. Any help would be very much appreciated.

Page:
Code:
<apex:page controller="ProspectDupeSearch" tabStyle="Lead">
    <apex:form >
        <apex:pageBlock title="Prospect Duplicate Search">
                <strong>Enter the last name, company, and/or email address for a new prospect you are looking to add.</strong>
                <br/><br/>
                Last Name<br /><apex:inputText id="searchName" value="{!searchName}"/>
                <br/><br/>
                Company<br /><apex:inputText id="searchCompany" value="{!searchCompany}"/>
                <br/><br/>
                Email<br /><apex:inputText id="searchEmail" value="{!searchEmail}"/>
                <br/><br/>
                <apex:commandButton value="Check for Duplicates" action="{!doSearch}" rerender="resultPanel"/>
        </apex:pageBlock>

        <apex:pageBlock title="Search Results">
            <apex:outputPanel id="resultPanel" layout="block">
                <apex:outputLink value="/00Q/e—name_lastlea2={!searchName}&lea3={!searchCompany}&lea11={!searchEmail}&retURL=%2F00Q%2Fo">Create new Prospect</apex:outputLink> 
                <apex:dataTable value="{!results}" var="r" cellPadding="4" border="1">
                    <apex:column >{!r.Name}</apex:column>
                    <apex:column >{!r.Company}</apex:column>
                    <apex:column >{!r.Email}</apex:column>
                    <apex:column >{!r.Owner.Name}</apex:column>
                </apex:dataTable>

                <apex:outputText id="sOutput" value="{!results}"/>
            </apex:outputPanel>
        </apex:pageBlock>
   
    </apex:form>
</apex:page>

Class:
Code:
public class ProspectDupeSearch {

    String searchName;
    String searchCompany;
    String searchEmail;
    List<Lead> results;

    public String getSearchName() { return searchName; }
    public void setSearchName(String s) { searchName = s; }

    public String getSearchCompany() { return searchCompany; }
    public void setSearchCompany(String s) { searchCompany = s; }
    
    public String getSearchEmail() { return searchEmail; }
    public void setSearchEmail(String s) { searchEmail = s; }
    
    // Return info
    public List<Lead> getResults() { return results; }

    public PageReference doSearch() {
        String queryString = 'SELECT Id,Name,Company,Email,Owner.Name FROM Lead WHERE IsConverted=False';
        queryString = queryString + ' AND Lead.Name LIKE \'%' + String.escapeSingleQuotes(searchName) + '%\'';
        queryString = queryString + ' AND Lead.Company LIKE \'%' + String.escapeSingleQuotes(searchCompany) + '%\'';
        queryString = queryString + ' AND Lead.Email LIKE \'%' + String.escapeSingleQuotes(searchEmail) + '%\'';
        queryString = queryString + ' ORDER BY LastName ASC';
        results = Database.query(queryString);
        return null;
    }
}


Thanks in advance.

-Greg

 

Friends,
I would like to export the bugs as CSV report from SF. I am not able to export the Notes and Attachments with the Bugs. Is there any specific way to export the notes and attachments along with the bugs please help me informed. Also,if there is any alternate way say, an ApI call any such thing to get the notes and attachments of the corresponding bugs please guide me in the process.
 
Thanks
Juli