• wsthesis
  • NEWBIE
  • 0 Points
  • Member since 2008

  • Chatter
    Feed
  • 0
    Best Answers
  • 0
    Likes Received
  • 0
    Likes Given
  • 4
    Questions
  • 2
    Replies

Am I allowed to pass a parameter from my visualforce page to a controller method?


I want to create a method which returns boolean TRUE or FALSE depending on if the related list contains any records. I'm trying to avoid creating 15-20 get/set methods.


 

Code:
VisualForce Page Segment:
<apex:page standardController="Account" extensions="AccountHiddenListControllerExtension">
    </apex:detail>
        <apex:relatedList list="contacts" rendered="{!doesRelatedListExist('contacts'}">>
        </apex:relatedList>
        <apex:relatedList list="ActivityHistories" rendered="{!doesRelatedListExist('ActivityHistories'}">>
        </apex:relatedList>
    </apex:detail>
</apex:page>

Controller class:
    public boolean doesRelatedListExist(String listName)
    {

        if (listName.equals('contacts'))
        {
            return ((this.getContactList().size()) > 0);
        }
        if (listName.equals('ActivityHistories'))
        {
            return ((this.getActivityHistoriesList().size()) > 0);
        }

        // default value
        return true;
    }


 

The controller saves correctly; however, i get the following error message when saving the visualforce page:
Error: Unknown function doesRelatedListExist. Check spelling. 


Thanks in advance.



Message Edited by wsthesis on 12-25-2008 06:26 PM
On many of the "home" tabs (ex) leads, contacts, accounts, opportunities) underneath the initial header, there is a
View: ____drop down list_______ [Go] {Edit Link} {Create New View}

I want to programmatically (using visual force or apex code) recreate this same drop down list in a new apex controller/visualforce page.
1. Where in the schema is this view information stored? What's the SOQL object name (or field(s)) to get this list of views (for use in a SOQL query)?
2. Is there an apex tag that renders this list?
Sorry for the double post in apex code/visual force, but I'm unsure which boundary it falls into. Thanks in advance.
 
I'm trying to use visualforce to perform the following:
A. Show related lists (and all headings) only if a related record exists.
B. If a related record does not exist, the particular section is not displayed.
 
I'm trying to use the apex:relatedList tag with the rendered attribute.
 
Is it possible to check if the list is empty as a boolean expression within visualforce without having to create a custom controller method? I have a working solution, but if I want to add this functionality for all related lists, it's a lot of extra controller code to write.
 
Thanks in advance.
 
 
VisualForce View Page
<apex:page standardController="Account" extensions="AccountHiddenListController">
    <apex:detail relatedList="false">
        <apex:relatedList list="Opportunities" rendered="{!relatedOpportunitiesExist}">    
        </apex:relatedList>
    </apex:detail>
</apex:page>
 
 
Controller Code:
public class AccountHiddenListController
{
    private final Account account;
    private boolean relatedOpportunitiesExist;
   
    public AccountHiddenListController (ApexPages.StandardController accountController)
    {
        this.account = (Account) accountController.getRecord();
    }
   
    public boolean getRelatedOpportunitiesExist()
    {
        if (this.relatedOpportunitiesExist != null)
        {
            return this.relatedOpportunitiesExist;
        }
   
        List<Opportunity> opp = this.getOpportunitiesList();
        if (opp.size() > 0)
        {
            this.relatedOpportunitiesExist = true;
        }
        else
        {
            this.relatedOpportunitiesExist = false;       
        }
        return this.relatedOpportunitiesExist;
           
    }
   
    public void setRelatedOpportunitiesExist()
    {
   
    }
   
    public List<Opportunity> getOpportunitiesList()
    {
        if (this.account == null)        
            return null;       
        return [select o.id
        from Opportunity o
        where o.AccountId = :account.id];
       
    }
   
}
I'm using the Force.com IDE and trying to integrate other people's code from code share. Specifically, I'm trying to integrate Google Maps/Google Earth functionality by using Ron Hess's project (force-google-earth found at: http://code.google.com/p/force-google-earth.
 
1. Is the preferred methodology to create a new folder under /src to add these source files?
2. Is it better to create an application? (ex) App Name = GoogleEarth, then copy all source files into the application)?
 
3. I tried to add the files in systematically into the respective source folders (ex) triggers/geocode.trigger from GoogleEarth project into my project) , but seem to get compile errors. Is there a specific order for how files should be added/deployed to force.com ide to prevent compile errors?
 
If my question(s) are not clear, please let me know and I can try to provide additional details. Thanks in advance.
 
On many of the "home" tabs (ex) leads, contacts, accounts, opportunities) underneath the initial header, there is a
View: ____drop down list_______ [Go] {Edit Link} {Create New View}

I want to programmatically (using visual force or apex code) recreate this same drop down list in a new apex controller/visualforce page.
1. Where in the schema is this view information stored? What's the SOQL object name (or field(s)) to get this list of views (for use in a SOQL query)?
2. Is there an apex tag that renders this list?
Sorry for the double post in apex code/visual force, but I'm unsure which boundary it falls into. Thanks in advance.