From the prefix it appears you are using an Account Id but check your Id one more time... I pasted this code into a DE and replaced the Id with a specific record in my org and the class compiled no problem.
You can reference the field directly as the getter method makes it public and accessable. The getLender() method creates a variable named 'lender' of type Lender__c
Account test = [SELECT CustomField__c FROM Account WHERE Id = '(...insert specific Id here...)' LIMIT 1];
Account test = [SELECT testfield__c FROM Account WHERE Id = '(001i000000UP1gF)' LIMIT 1];
Hi jcaldito, Pls cross check the provided id correct.
try something like this
Account test = [SELECT testfield__c FROM Account WHERE Id =: '001i000000UP1gF' LIMIT 1];
Error: Compile Error: Return value must be of type: Account at line 4 column 5
Can someone tell me what I am doing wrong?
public class mySecondController {
public Account getAccount() {
return [SELECT Factor_Rate__c FROM Account WHERE Id =: '001i000000UP1gF' LIMIT 1];
}
public String getName() {
return 'My Second Custom Controller';
}
}
public Lender__c getLender() {
return [SELECT Lender_name__c FROM Lender__c WHERE Id =: 'a0kJ0000000xnD9' LIMIT 1];
}
<apex:outputField value="{!Worksheet__c.Get_Lender__r.Lender_name__c}"/>
please help. thanks
<apex:outputField value="{!lender.Lender_Name__c}" />
for more information: http://www.salesforce.com/us/developer/docs/pages/Content/pages_quick_start_controller_getter_methods.htm
so when I add worksheet__c to <apex:outputField value="{!worksheet__c.lender.Lender_Name__c}" />
I get an error: Error: Invalid field lender for SObject Worksheet__c