• navanitachora
  • NEWBIE
  • 0 Points
  • Member since 2012

  • Chatter
    Feed
  • 0
    Best Answers
  • 0
    Likes Received
  • 0
    Likes Given
  • 5
    Questions
  • 6
    Replies

Hi,

 

I am at present working on a visualforce interface similar to the one shown at:

 

http://www.salesforce.com/us/developer/docs/pages/Content/pages_quick_start_tabs.htm

 

I would like to redirect to a specific tab under the Accounts tab. For example the opportunities tab under the Account tab using the URLFOR function.

 

I could not find any examples that did this which is why I am little puzzled about how to go about this.

 

Thanks in advance.

nav

Dear folks,

 

I am making an application in Salesforce where I need to display a SelectList of values based on the selection made in a another SelectList. I have worked with other Web development platforms but have only just started on Salesforce four days ago.  Please bear with me.

 

I am getting a very obsure compiling error and not able to progress any further:

Error: TimesheetEntry Compile Error: The method LIST<System.SelectOption> getProjects() is referenced by Visualforce Page (timesheet) in salesforce.com. Remove the usage and try again. at line 20 column 31

 

All I need to do is direct the id of the parameter to the getProjects method and render the returned SelectList on the page. I believe this is possible in Salesforce but I have not found a solution.

 

My VisualForce code is below:

 

<apex:page controller="TimesheetEntry" sidebar="false">
    <apex:pageBlock title="Timesheet Entry">
    
    <apex:pageBlockSection >
    Resource Name: {!$User.FirstName} {!$User.LastName}
    </apex:pageBlockSection>
    
    <apex:form >
    <apex:pageBlockSection columns="4">
    
    <apex:pageBlockSectionItem >
    <apex:selectList value="{!accountID}" size="1">
        <apex:selectOptions value="{!accounts}">
        </apex:selectOptions>
    </apex:selectList>
    </apex:pageBlockSectionItem>
    <apex:outputPanel>
        <apex:actionSupport event="onchange" action={!projects} rerender="projectSectionItem">
            <apex:param name="accountid" value="{!accountID}" />
        </apex:actionSupport>
    </apex:ouputPanel>
    
    
    <apex:outputPanel id="projectSectionItem" style="display:{!if(showProjects,'block','none')};">
    <apex:selectList value="{!projectID}" size="1">
        <apex:selectOptions value="{!projects}">
        </apex:selectOptions>
    </apex:selectList>
    </apex:outputPanel>
    
    </apex:pageBlockSection>
    </apex:form>
    </apex:pageBlock>
</apex:page>

and this is my controller code:

public with sharing class TimesheetEntry {
    
    public String projectID { get; set; }
    public String accountID { get; set; }
    public Boolean showProjects { get; set; }
    
    public TimesheetEntry() {
        showProjects = false;
    }

    public List<SelectOption> getAccounts() {
        List<SelectOption> accOptions = new List<SelectOption>();
        accOptions.add(new SelectOption('Select Account', '--Select Account--'));
        for (Account account: [SELECT id, Name FROM Account]) {
           accOptions.add(new SelectOption(account.id, account.Name));
        }
        return accOptions;
    }
    
    public List<SelectOption> getProjects(String accountid) {
        showProjects = true;
        List<SelectOption> projOptions = new List<SelectOption>();
        projOptions.add(new SelectOption('Select Project', '--Select Project--'));
        for (Project__c project: [SELECT id, Name FROM Project__c]) {
            projOptions.add(new SelectOption(project.id, project.Name));
        }
        return projOptions;
    }

 

Thanks in advance.

nav

 

Hi,

 

I am very new to Salesforce but have Java and Python Web programming experience and have got the problem in the subject line.

 

My apex controller code is:

 

public class TimesheetEntry {
    public List<SelectOption> options;
    public TimesheetEntry() {
    }

    public List<SelectOption> getAccountItems() {
        List<SelectOption> options = new List<SelectOption>();
        for (Account account: [SELECT name, id FROM Account]) {
            options.add(new SelectOption(account.name));
        }
        return options;
    }
}

 

for some reason it is complaining about the line:

 

options.add(new SelectOption(account.name));

 I have seen a number of forum posts where the reason for the error was that what was sent to SelectOption was not a string but in this case account.name is a string. I have also tried type casting but that has not worked.

 

I would be most grateful for any pointers.

 

Many thanks.