You need to sign in to do that
Don't have an account?
U Jay
SendMailingAddressNotificationAcntCntrlr Compile Error: Initial term of field expression must be a concrete SObject
public void sendHouseHoldmailingAddressNotificationAction(){
Messaging.SingleEmailMessage mail = new Messaging.SingleEmailMessage();for(String destinationEmailItem : fetchDestination()){
String emailAddr = destinationEmailItem.Email;
<<<some code>>>
}
}
public List<Contact> fetchDestination(){
List<Contact> destination = new List<Contact>();
for(Contact contactRecord : [SELECT id, Account.BillingCity, Account.Billingstate, Age_Group__c, npsp__Current_Address__c,AccountID, Account.Invalid_Address__c, Email
FROM Contact
WHERE Account.Invalid_Address__c = True AND Age_Group__c = 'Adult' AND Email != null]){
destination.add(contactRecord);
}
if(destination.size() > 0){
return destination;
}
else{
return null;
}
}
I got error "SendMailingAddressNotificationAcntCntrlr Compile Error: Initial term of field expression must be a concrete SObject: String at" bold line. Why?
Thanks in advance.
Messaging.SingleEmailMessage mail = new Messaging.SingleEmailMessage();for(String destinationEmailItem : fetchDestination()){
String emailAddr = destinationEmailItem.Email;
<<<some code>>>
}
}
public List<Contact> fetchDestination(){
List<Contact> destination = new List<Contact>();
for(Contact contactRecord : [SELECT id, Account.BillingCity, Account.Billingstate, Age_Group__c, npsp__Current_Address__c,AccountID, Account.Invalid_Address__c, Email
FROM Contact
WHERE Account.Invalid_Address__c = True AND Age_Group__c = 'Adult' AND Email != null]){
destination.add(contactRecord);
}
if(destination.size() > 0){
return destination;
}
else{
return null;
}
}
I got error "SendMailingAddressNotificationAcntCntrlr Compile Error: Initial term of field expression must be a concrete SObject: String at" bold line. Why?
Thanks in advance.
What is the return type of this( fetchDestination() ) function.
If it is returning a string then use "String emailAddr = destinationEmailItem;"
instead of "String emailAddr = destinationEmailItem.Email;".
Then you should use.
for(Contact con : fetchDestination()){
String emailAddr = con.Email;
<<<some code>>>
}
To get all the Email Address you should use List of string.
for(Contact con : fetchDestination()){
List<String> emailAddrList = new List<String>();
String emailAddr = con.Email;
emailAddrList.add(emailAddr);
<<<some code>>>
}