0

Page:

<apex:page showHeader="true" sidebar="true" controller="ComposeEmailController">
<apex:stylesheet value="{!URLFOR($Resource.bootstrap, 'sf-bootstrap/css/bootstrap.min.css')}"/>
<apex:includeScript value="{!URLFOR($Resource.bootstrap, 'sf-bootstrap/js/bootstrap.min.js')}"/>

<apex:form styleClass="form-horizontal">
    <div class="form-group">
        <apex:selectList value="{!fromAddresses}" multiselect="false">
        </apex:selectList>
    </div>
</apex:form>

Controller:

public class ComposeEmailController {

String fromAddress{get; set;}
Case memberCase {get; set;}
Account account {get; set;}
Contact contact {get; set;}
public List<From_Email_Address__c> fromAddresses;


    public ComposeEmailController() {
        fromAddresses = [Select Id, Name, From_Address__c FROM From_Email_Address__c ORDER BY Name];
    }
}

Error:

Unknown property 'ComposeEmailController.fromAddresses' (Line: 1, Column: -1)

  • have a get;set; for fromAddresses – Prady Mar 1 '16 at 18:51
  • I tried that and am still getting the same error – TemporaryFix Mar 1 '16 at 18:51
  • Thats really strange. – Prady Mar 1 '16 at 18:57
1

You are getting this error because:

  • You have not defined property named fromAddresses in Controller
  • The property is not public
  • you have not defined {get; set;}
  • I've added get and set and am still receiving the error – TemporaryFix Mar 1 '16 at 18:57
  • Can you post the updated code? – Prady Mar 1 '16 at 18:59
  • Found the issue. The list needs to be of type string not sObject – TemporaryFix Mar 1 '16 at 19:03
  • Good, that you got it resolved. – Prady Mar 1 '16 at 19:05
0

Found the issue

public List<From_Email_Address__c> fromAddresses;

This must be of type string not From_Email_Address__c

Updated controller:

public class ComposeEmailController {

String fromAddress{get; set;}
Case memberCase {get; set;}
Account account {get; set;}
Contact contact {get; set;}
public List<String> fromAddresses {get; set;}
private Map<String, String> fromAddressesMap;


    public ComposeEmailController() {
        List<From_Email_Address__c> addresses = [Select Id, Name, From_Address__c FROM From_Email_Address__c ORDER BY Name];
        System.debug('I have this many addresses: ' + addresses.size());
        fromAddresses = new List<String>();
        fromAddressesMap = new Map<String, String>();
        for(From_Email_Address__c email : addresses){
            fromAddresses.add(email.Name);
            fromAddressesMap.put(email.Name, email.From_Address__c);
        }
    }
}

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.