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 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(); } }", "answerCount": 1, "upvoteCount": 0, "datePublished": "2021-05-25T20:55:30.000Z", "author": { "@type": "Person", "name": "Nicholas Shepard", "url": "https://trailblazers.salesforce.com/profileView?u=0054S000001EuyKQAS", "affiliation": { "@type": "Organization", "name": "rebel Financial" } }, "suggestedAnswer": [ { "@type": "Answer", "text": "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.  ", "upvoteCount": 0, "url": "https://trailhead.salesforce.com/trailblazer-community/feed/0D54V00007T428OSAR", "datePublished": "2023-06-22T08:10:20.000Z", "author": { "@type": "Person", "name": "Developer Forums User (Inactive)", "url": "https://trailblazers.salesforce.com/profileView?u=0054V00000H86IwQAJ", "affiliation": { "@type": "Organization", "name": "Salesforce Developer Forums" } } } ] } } Skip to main content
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();

}

}

 
1 件の回答
  1. 2023年6月22日 8:10
    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.