• 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 have a page with a number of tabs as shown in the code below:

 

<apex:page controller="Administration">
    <apex:tabPanel switchType="client" id="theTabPanel">
        <apex:tab label="Account">Content for Account</apex:tab>
        <apex:tab label="Project">Content for Projects</apex:tab>
        <apex:tab label="Milestone">Content for Milestone</apex:tab>
        <apex:tab label="Activity">Content for Activity</apex:tab>
    </apex:tabPanel>
</apex:page>

 What I need to do is render the Accounts home page with the new, save etc buttons in the Accounts tab. Clicking on new should render the new account view inside the tab similarly for other functions.

 

Since the account standard controller comes prebuilt with the new, save etc functions I want to know how to instantiate the controller inside the tab. I cannot use standardController="Account" because I have other objects which require the same functionality.

 

I do not have anything in my controller file yet as I could not find a starting point.

 

Thanks,

nav

 

 

Hi,

 

I am fairly new to salesforce and am making a TimeSheet app.

 

What I have is a dropdown box with a list of accounts. Once an account is selected it should show a dropdown box that contains a list of projects connected to that account. The accounts dropdown box shows but every time a click on an item in the account I get:

 

 

System.NullPointerException: Attempt to de-reference a null object
Error is in expression '{!projectsByAccount}' in component <apex:page> in page timesheet

Class.TimesheetEntry.projectsByAccount: line 36, column 1

Here is my VisualForce code:

 

<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:actionSupport event="onchange" action="{!projectsByAccount}" rerender="projectSectionItem">
            <apex:param name="accountid" assignTo="{!accountID}" value="{!accountID}" />
        </apex:actionSupport>
    </apex:selectList>
    </apex:pageBlockSectionItem>
    
    
    <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 here is my Custom Controller code:

 

public with sharing class TimesheetEntry { // sharing class so that user permissions are respected
    
    public String projectID { get; set; }
    public String accountID { get; set; }
    public Boolean showProjects { get; set; }
    public List<SelectOption> projOptions { get; set;}
    
    // Constructor
    public TimesheetEntry() {
        // Do not show the projects dropdown on page load
        System.debug('Constructor');
        showProjects = false;
        List<SelectOption> projOptions = new List<SelectOption>();
    }
    
    // Method referenced in VF page as {!accounts}
    public List<SelectOption> getAccounts() {
        System.debug('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;
    }
    
    // Method referenced in VF page as {!projects}
    public List<SelectOption> getProjects() {
        System.debug('getProjects');
        return projOptions;
    }
    
    // Action call in VF page {!projectsByAccount} referecnces this method
    public PageReference projectsByAccount() {
        System.debug('Inside page reference');
        projOptions.add(new SelectOption('Select Project', '--Select Project--'));
        System.debug('Added first item');
        for (Project__c project: [SELECT id, Name FROM Project__c WHERE 
                Project__c.Account__r.id =: accountID]) {
                projOptions.add(new SelectOption(project.id, project.Name));
            }
        return null;
    }
}

 The only debug statement that is not displayed in the System log is:

 

 

System.debug('Added first item');

so I believe that the problem lies in what happens before this line. Being new to the Salesforce platform I am finding it difficult to work it out.

 

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.

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.