function readOnly(count){ }
Starting November 20, the site will be set to read-only. On December 4, 2023,
forum discussions will move to the Trailblazer Community.
+ Start a Discussion
Nicholas Shepard 7Nicholas Shepard 7 

Accessing custom object fields within a standard controller page

Hello! So I'm extremely new to SalesForce and I'm having some problems with accessing fields I need. I'm trying to access certain fields of a custom object to graph them, and given that this object cannot be set as a controller, I'm pretty lost on what to do. Basically, I need to access the fields you see between lines 27 & 60. Below is my current code.

Thank you in advance!

VisualForce Page
<!-- Displays a Contact's account information in SF. --->
<apex:page standardController="Contact" extensions="NewAcctTimelineController, AcctTimelineFinancialController">
  <html>
	<head>
	  <script type="text/javascript" src="https://www.gstatic.com/charts/loader.js"></script>
      <script type="text/javascript">
		// Required Google Chart Lines.
		google.charts.load("current", {packages:["corechart"]});
		function collectData()
        {    
			// Variable Declaration
			var numAccts, data;
			var accountIds = {!listOfAccountNums};
			// For each account a contact has, collect the specific data for that account
			for(account in accountIds)
            {
            	var i = 0, acctDataSet = [];
                tempAcctId.set(account);
                acctDataSet.push(["Year", "Total"]);
                for(i = 1; i <= 12; i++)
                {
                    monthCount.set(i);
					var dateToGraph = new Date({!YEAR(TODAY())},{!MONTH(TODAY())-monthCount});
                    var moneyToGraph = null;
                    switch(i){
                    	case 1:
                            moneyToGraph = {!tempVal.ACTDDEV__FAPriorMonthTotal__c};
                            break;
                        case 2:
                            moneyToGraph = {!tempVal.ACTDDEV__FA2MonthsAgoTotal__c};
                            break;
                        case 3:
                            moneyToGraph = {!tempVal.ACTDDEV__FA3MonthsAgoTotal__c};
                            break;
                        case 4:
                            moneyToGraph = {!tempVal.ACTDDEV__FA4MonthsAgoTotal__c};
                            break;
                        case 5:
                            moneyToGraph = {!tempVal.ACTDDEV__FA5MonthsAgoTotal__c};
                            break;
                        case 6:
                            moneyToGraph = {!tempVal.ACTDDEV__FA6MonthsAgoTotal__c};
                            break;
                        case 7:
                            moneyToGraph = {!tempVal.ACTDDEV__FA7MonthsAgoTotal__c};
                            break;
                        case 8:
                            moneyToGraph = {!tempVal.ACTDDEV__FA8MonthsAgoTotal__c};
                            break;
                        case 9:
                            moneyToGraph = {!tempVal.ACTDDEV__FA9MonthsAgoTotal__c};
                            break;
                        case 10:
                            moneyToGraph = {!tempVal.ACTDDEV__FA10MonthsAgoTotal__c};
                            break;
                        case 11:
                            moneyToGraph = {!tempVal.ACTDDEV__FA11MonthsAgoTotal__c};
                            break;
                        case 12:
                            moneyToGraph = {!tempVal.ACTDDEV__FA12MonthsAgoTotal__c};
                            break;
                        default:
                            console.log("Error! No Value Found.");
                            break;
                    }
                    acctDataSet.push([dateToGraph, moneyToGraph]);
                }
                var processedData = google.visualization.arrayToDataTable(acctDataSet);
                var options = {
         			title: 'Account Timeline',
           			hAxis: {title: 'Date'},
           			vAxis: {title: 'Value'},
         			legend: 'none',
         			crosshair: { trigger: 'both', orientation: 'both' },
           			pointShape: 'diamond',
           			pointSize: 12,
            	}
                var chart = new google.visualization.AreaChart(document.getElementById('chart_pointSize'));
       			chart.draw(processedData, options);
		}
      </script>
	</head>
	<body>
        <div id='chart_pointSize' style='width: 1200px; height: 500px;'></div>
    </body>
  </html>
</apex:page>
Custom Extension
public with sharing class NewAcctTimelineController {
	
    public Integer monthCount {get;set;}
    public String tempAcctId {get;set;}
    private final Contact contact {get;set;}
    private final String contactId {get;set;}
    public ACTDDEV__EAST_FinancialAccount__c tempVal {get;set;}
    public List<ACTDDEV__EAST_FinancialAccount__c> listOfAccountNums{get;set;}
    
    // Constructor.
    public NewAcctTimelineController(ApexPages.StandardController stdController){
        this.contactId = stdController.getId();
        listOfAccountNums = [SELECT acct.Name FROM ACTDDEV__EAST_FinancialAccount__c acct where acct.ACTDDEV__AccountOwner__c =: this.contactId];
        this.tempVal = (ACTDDEV__EAST_FinancialAccount__c)stdController.getRecord();
    }
}


 
Baya AdamBaya Adam
Academic Master is a US based writing company that provides thousands of free essays to the students all over the World. If you want your essay written by a highly professional writers, then you are in a right place. We have hundreds of highly skilled writers working 24/7 to provide quality  essay writing services  to the students all over the World.
 
Charles MorrisonCharles Morrison
When you hire someone to write your term papers, you should always make sure that their first language is English. This is especially important if you want your papers to be taken seriously penalty kick online. To ensure that the audience is able to comprehend what you have written, include credible sources in your papers is of great assistance.